Database - HyperSQL DataBase (HSQLDB)

Card Puncher Data Processing

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)

Ref

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





Discover More
Card Puncher Data Processing
Calcite (Farrago, Optiq)

Calcite is a Java SQL Processing engine where the data storage is developed in plugin. Calcite is an open source cost based query optimizer and query execution framework. SQL Parser SQL Validation...
Data System Architecture
What are embedded databases?

embedded databases are database that run in an embedded mode: It means that it: runs along the code of the application in the same thread does not run as a service (ie client server mode) Pros:...



Share this page:
Follow us:
Task Runner