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

About giannigar

Senior Software Engineer - Groupon - Dublin, Ireland

Posted on April 8, 2012, in Java and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Bright Side of Java & Linux

Yet another Java blog

mysoftwarequality

Bringing empathy into knowledge workers life

Jess & the City

Cynical ramblings of a Latin girl living in Dublin

%d bloggers like this: