Is there a simpler way? To start many database we can create simple file "start.sh"
Before start to use create separate folders for each databases.
/opt/db/trunk
/opt/db/master
Next one copy to "start.sh":
#!/bin/sh
java -cp ./hsqldb/lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:/opt/db/master/master --dbname.0 master --database.1 file:/opt/db/trunk/trunk --dbname.1 trunk
Make this file to be executable:
chmod +x start.sh
Start to run:
$ ./hsqdb.sh
Output:
...
[Server@15c7850]: Database [index=0, id=0, db=file:/opt/db/trunk/trunk, alias=trunk] opened sucessfully in 426 ms.
[Server@15c7850]: Database [index=1, id=1, db=file:/opt/db/master/master, alias=master] opened sucessfully in 128 ms.
...
[Server@15c7850]: From command line, use [Ctrl]+[C] to abort abruptly
So you will get two databases with aliases: trunk and master
Example how to configure HSQL Database Manager:
Type: HSQL Database engine server
Driver: org.hsqldb.jdbcDriver
URL: jdbc:hsqldb:hsql://localhost:9001/trunk
User: SA
Password:
You can change the alias trunk to another alias
JDBC URL connection:
jdbc:hsqldb:hsql://localhost:9001/trunk
jdbc:hsqldb:hsql://localhost:9001/master
HSQLDB (HyperSQL Database) HSQLDB is an open source project, also written in Java, representing a relational database. It follows the SQL and JDBC standards and supports SQL features such as stored procedures and triggers. It can be used in the in-memory mode, or it can be configured to use disk storage.
You could write a more generalized script to start the databases.
Some thoughts on the steps the script would have to do
start_string
. initialize with java -cp ./hsqldb/lib/hsqldb.jar org.hsqldb.server.Server
/opt/db/
)
--database.<counter_variable> file:<parent_folder>/<db_name>/<db_name> --dbname.<counter_variable> <db_name>
to start_string
start_string
You can then pass the list of DB names to your program, which will connect to them using URL: jdbc:hsqldb:hsql://localhost:9001/<db_name>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With