Search code examples
jdbchsqldb

How can I save HSQLDB in-memory data to file without calling SHUTDOWN statement


I set "file:" catalog but it saves in-memory data in that file only after SHUTDOWN statement. Is there any way to do that without db shutdown?


Solution

  • When your JDBC connection URL has a jdbc:hsqldb:file: prefix, the database is file-based. You can execute the CHECKPOINT statement anytime to write the up-to-date data contents to the .script file.

    With all database types, including pure in-memory databases with jdbc:hsqldb:mem: URL's, you can use the SCRIPT 'full_file_path_name_to_save' statement to write the contents to a file of your choice.