HSQLDB is a relational database management system implemented in pure Java. You can easily embed this database to your application using JDBC. Or you can use the operations separately.
Follow the prerequisite software installations for HSQLDB.
Since HSQLDB is a relational database management system implemented in pure Java, you must install JDK (Java Development Kit) software before installing HSQLDB. If you already have JDK installation in your system, then try the following command to verify the Java version.
java –version
If JDK is successfully installed in your system, you will get the following output.
java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
If you don’t have JDK installed in your system, then visit the following link to Install JDK.
Following are the steps to install HSQLDB.
Step 1 − Download HSQLDB bundle
Download the latest version of HSQLDB database from the following link https://sourceforge.net/projects/hsqldb/files/. Once you click the link, you will get the following screenshot.
Click HSQLDB and the download will start immediately. Finally, you will get the zip file named hsqldb-2.3.4.zip.
Step 2 − Extract the HSQLDB zip file
Extract the zip file and place it into the C:\ directory. After extraction, you will get a file structure as shown in the following screenshot.
Step 3 − Create a default database
There is no default database for HSQLDB, therefore, you need to create a database for HSQLDB. Let us create a properties file named server.properties which defines a new database named demodb. Take a look at the following database server properties.
server.database.0 = file:hsqldb/demodb server.dbname.0 = testdb
Place this server.properties file into HSQLDB home directory that is C:\hsqldb- 2.3.4\hsqldb\.
Now execute the following command on command prompt.
\>cd C:\hsqldb-2.3.4\hsqldb hsqldb>java -classpath lib/hsqldb.jar org.hsqldb.server.Server
After execution of the above command, you will receive the server status as shown in the following screenshot.
Later, you will get to find the following folder structure of the hsqldb directory in the HSQLDB home directory that is C:\hsqldb-2.3.4\hsqldb. Those files are temp file, lck file, log file, properties file, and script file of demodb database created by HSQLDB database server.
Step 4 − Start the database server
Once you are done creating a database, you have to start the database by using the following command.
\>cd C:\hsqldb-2.3.4\hsqldb hsqldb>java -classpath lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:hsqldb/demodb --dbname.0 testdb
After execution of the above command, you get the following status.
Now, you can open the database home screen that is runManagerSwing.bat from C:\hsqldb-2.3.4\hsqldb\bin location. This bat file will open the GUI file for HSQLDB database. Before that it will ask you for database settings through a dialog box. Take a look at the following screenshot. In this dialog box, enter the Setting Name, URL as shown above and click Ok.
You will get the GUI screen of HSQLDB database as shown in the following screenshot.