HSQLDB
Install and configure a self-managed HSQLDB server for development and testing purposes.
Last Updated: 26 May 2022 • Page Author: Jillur Quddus
Overview
HyperSQL Database (HSQLDB) is an open-source Java-based relational database management system (RDBMS). This page provides instructions on how to install and configure a self-managed HSQLDB server for development and testing purposes only (i.e. non-production).
This page provides instructions on how to install and configure a self-managed HSQLDB server for development and testing purposes only. To configure a secure production-ready instance of HSQLDB server, please refer to the HyperSQL documentation.
The instructions below are for Ubuntu 20.04. Installation instructions for other Linux distributions and Windows are almost identical (assuming that Java is installed) as HSQLDB server is a 100% Java-based RDBMS.
Installation
To download HSQLDB, you can visit http://hsqldb.org and follow the "Download" link. Alternatively you can use Apache Maven and add HSQLDB as a dependency in a project. If you have followed the instructions in Build from Source to download, compile and build POB, then you will already have downloaded the HSQLDB JAR (Java ARchive) file into your local Maven repository.
Starting HSQLDB
By default HSQLDB server will run in-memory. To configure HSQLDB to persist databases to disk, and hence persist databases across server restarts, we can use the file
data catalog type when running HSQLDB server and provide the path where data should be written to. For further information regarding HSQLDB data catalog types, please visit http://hsqldb.org/doc/2.0/guide/running-chapt.html.
To start HSQLDB server using disk-based storage, simply navigate to the directory containing the downloaded HSQLDB JAR file (e.g. hsqldb-2.6.0.jar) and run the following command via your command line (which naturally requires Java to have been installed as a dependency):
The command above will start HSQLDB server using disk-based storage, create or load a database called pob
(you may call it anything you wish) and persist data from that database into a directory also called pob
(you may call it anything you wish) relative to the current directory. You may also provide an absolute path to a data directory of your choice.
After starting HSQLDB server with default settings and using the command above, services and applications may connect to your HLSQDB server and database instance using the following JDBC URL: jdbc:hsqldb:hsql://localhost:9001/pob.
POB Context
To configure POB to use HSQLDB, please configure the storage.rdbms namespace in application.yml as follows:
Property | Description | Example Value |
---|---|---|
driverClassName | The JDBC driver to use when connecting to the RDBMS. | org.hsqldb.jdbc.JDBCDriver |
url | The JDBC connection string to connect to the RDBMS. Note that the URL should be set as an externalised variable and NOT stored as plaintext in application.yml. | jdbc:hsqldb:hsql://localhost:9001/pob |
username | The username to authenticate the connection to the RDBMS. Note that the username should be set as an externalised variable and NOT stored as plaintext in application.yml. | sa |
password | The password to authenticate the connection to the RDBMS. Note that the password should be set as an externalised variable and NOT stored as plaintext in application.yml. | password |
For further information regarding configuring Spring JPA data sources, please visit https://docs.spring.io/spring-boot/docs/2.1.x/reference/html/howto-data-access.html.
Last updated