Reputation: 605
I am using an in-memory hsqldb
database with a JDBC
driver.
Now, I am looking for a way to persist this database for reloading after application reboot. I came up with the following options:
Option 2 works, but it seems kind of ugly in my eyes. The script export for option 1 works too, but I seem to be unable to get the .script file back into an in-memory database.
I am thankful for any advice.
Upvotes: 2
Views: 1583
Reputation: 24352
The first option is correct.
After you export the database with the SCRIPT <path>
statement, you can get it into an in-memory database.
You need to connect to the scripted database with a read-only file:
URL
For example if you export the database to d:/dbfiles/mydb.script
, you will get the mydb.script
file in the named directory. To connect to this database, use file:d:/dbfiles/mydb;files_readonly=true
.
There is absolutely no speed difference between the above method and a mem: database.
Upvotes: 2