Has HSQLDB some mechanism for saving in-memory data to file?
As I know after the server is shutted down, all in-memory data become unaccessible. So I want to save all in-memory data to file. Unfortunately I can't use BACKUP mechanism, because it can't be applied for in-memory data.
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.
HSQLDB is available under a BSD license. It is used as a database and persistence engine in many open source software projects, such as descendants of OpenOffice.org Base (i.e., Apache OpenOffice Base, LibreOffice Base, etc.), and the Jitsi VoIP and video-conference client since version 2.6.
Because we started an in-memory instance the connection url is a memory database url that looks like jdbc:hsqldb:mem:instanceName You will not be able to connect using this url because neither the host and the port are available, instead you should use a server database url that looks like jdbc:hsqldb:hsql://host:port/ ...
In-memory databases are purpose-built databases that rely primarily on memory for data storage, in contrast to databases that store data on disk or SSDs. In-memory data stores are designed to enable minimal response times by eliminating the need to access disks.
HSQLDB databases are of different types. The all-in-memory databases do not store the data to disk. These databases have URLs in the form jdbc:hsqldb:mem:<name>
.
If your database URL is in the form jdbc:hsqldb:file:<file path>
and your tables are the default MEMORY tables, the data is all in memory but the changes are written to a set of disk files.
With all types of database, including all_in_memory, you can use the SQL statement SCRIPT <file path>
to save the full database to a file. If you save the data to a file with the .script
extension, you can open the file as a file database.
When you run a server, the URL's are used without the jdbc:hsqldb
prefix, for example server.database.0=file:C:/myfile
See the guide here http://hsqldb.org/doc/2.0/guide/running-chapt.html#running_db-sect
There is an SQL command for that. Try this:
SCRIPT '/tmp/data.sql'
See here for details.
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