databaseconfigurationhsqldbhypersql

HyperSQL Server 2.4.1 creating new database during runtime


I have quick question. Is it possible to add new database when HSQL Server is running?

Quick view:

Is it possible?

There is easy for many database systems but for HSQL I cannot find anything...


Solution

  • You need to start the server in a special remote_open mode which allows new databases to be opened. In addition, you need to specify the file path of the new database when you connect. When the server is started, check the messages for remote-open. Then connect with a URL like this jdbc:hsqldb:hsql://localhost/testx;file:mytextxfile In the URL testx is the network id of the database and file:mytextxfile is the file path of the database files.

    Server messages when it starts:

    [Server@4c5e176f]: Startup sequence initiated from main() method
    [Server@4c5e176f]: Loaded properties from [C:\ft\hsqldb_w_1_8_0_n_work\server.properties]
    [Server@4c5e176f]: [Thread[main,5,main]]: start() entered
    [Server@4c5e176f]: [Thread[HSQLDB Server @4c5e176f,5,main]]: run() entered
    [Server@4c5e176f]: Initiating startup sequence...
    [Server@4c5e176f]: [Thread[HSQLDB Server @4c5e176f,5,main]]: server.maxdatabases=10
    [Server@4c5e176f]: [Thread[HSQLDB Server @4c5e176f,5,main]]: server.remote_open=true
    [Server@4c5e176f]: [Thread[HSQLDB Server @4c5e176f,5,main]]: server.tls=false
    ....
    

    Server messages when connecting to new database:

    [Server@4c5e176f]: [Thread[HSQLDB Connection @63db6942,5,HSQLDB Connections @4c5e176f]]: 2:Trying to connect user 'SA' to DB (testx;file:mytextxfile)
    [Server@4c5e176f]: [Thread[HSQLDB Connection @63db6942,5,HSQLDB Connections @4c5e176f]]: 2:Connected user 'SA'