HSQLDB – some tips

I have been working these days with Spring3 and as DB I have used HSQLDB.

Types of catalog data

  • mem: stored entirely in RAM – without any persistence beyond the JVM process’s life
  • file: stored in filesystem files
  • res: stored in a Java resource, such as a Jar and always read-only

so the URL in java or spring context would looks like this:

"jdbc:hsqldb:file:testdb"
"jdbc:hsqldb:file:/opt/db/testdb"
"jdbc:hsqldb:mem:mymemdb"
"jdbc:hsqldb:res:org.my.path.resdb"

Turning on HSQLDB GUI in eclipse

in eclipse find the hsqldb.jar (usually lib folder) -> do right click and select “run as java” -> from the list select “DatabaseManagerSwing”

Get rid of “The database is already in use by another process”

For this error I have heard that you should use “shutdown=true” syntax in URL. So this would look like :

"jdbc:hsqldb:file:testdb;shutdown=true"  everything put in one single line (doc)

driver=org.hsqldb.jdbcDriver
url=jdbc:hsqldb:file:app.db;shutdown=true
username=sa
password=

That’s it. more can be found in google or HSQLDB doc.

Advertisements