About
HSQLDB is a relational database written in Java.
It is used
- as an embedded database to avoid the requirement of having a third-party database server running separately.
- for unit and integration testing as it offers a (volatile) in-memory storage.
HSQLDB stores data in local files
Database (Storage and Url Example)
Each HyperSQL database is called a catalog
Memory
- mem: stored entirely in RAM - without any persistence beyond the JVM process's life
- Memory: jdbc:hsqldb:mem:testdb;shutdown=true
File
file: stored in filesystem files
- File System: jdbc:hsqldb:file:db/name
For example, the database named “test” consists of the following files:
- test.properties - a few settings about the database
- test.script - the definition of tables and other database objects, plus the data for non-cached tables.
- test.log - recent changes to the database (when open)
- test.data - the data for cached tables
- test.backup - compressed backup of the last known consistent state of the data file
- test.lobs
- test.lck - database status is open. Deleted at a normal SHUTDOWN.
- xxx.new - temporary files (should not be deleted)
Java Resource
res: stored in a Java resource, such as a Jar and always read-only
File structure
- .script contains all the statements to create the tables, alter them and insert the data. This file is created when you use hsqldb in memory. (so I'd say this is your database) Otherwise the database is stored in .data as other people already said
- .lck is the lock file by which hsqldb knows whether the database is used/locked by a process. This file is automatically deleted when you stop the program.
- .log is used to write the changes made to data. This file is removed at a normal SHUTDOWN. Otherwise (with abnormal shutdown) this file is used at the next startup to redo the changes.
- .properties contains the properties with which hsqldb is initialized
- .data: exist after adding records to database.
Driver
- Gradle
compile("org.hsqldb:hsqldb:2.5.0")
Note
- Default of looker and Calcite
- h2 is a little bit more popular