Blog Archives

Quick HSQLDB How To


HSQLDB is a 100% pure Java SQL database. I often make use of it when I’m working on proof of concepts or tests.

You can download it at http://sourceforge.net/projects/hsqldb/files/hsqldb/.

In order to run it, it’s required to have a JVM installed and the JAVA_HOME environmental variable pointing to it.

I recommend to create a folder in your home directory (or wherever else) where storing all the files required for your dbs.

In order to start a db instance, simply execute:

java -cp ../hsqldb.jar org.hsqldb.server.Server --database.0 file:mydb --dbname.0 db_name

Where:

  • ../hsqldb.jar is the path to the hsqldb library
  • mydb is the prefix of the file names that will be create
  • db_name is the name of the schema we will have to use when connecting

A very nice utility application that is shipped with the hsqldb binary is the DatabaseManagerSwing. It’s a simple one but it’s enough to navigate and query your freshly created db. Syntax for starting it is:

java -cp ../hsqldb.jar org.hsqldb.util.DatabaseManagerSwing

DatabaseManagerSwing remembers last connections you’ve created and helps to save plenty of time when you need to switch from a db to another.

This quick, nearly useless, tutorial will come in help with one of the next post I’m going to create.

-Sieze

Advertisements
The Bright Side of Java & Linux

Yet another Java blog

mysoftwarequality

Bringing empathy into knowledge workers life

%d bloggers like this: