HSQLDB Setup made easy in Ubuntu

If you want a quick, light weight database to just run and get started with, HSQLDB will satisfy needs instantly with a delightful approach.

  1. Download from http://sourceforge.net/projects/hsqldb/files/hsqldb/
  2. Unzip it
  3. copy hsqldb/sample/server.properties to hsqldb folder (since i am running the server from this directory)
  4. modify the line server.database.0 file:db0/db0 by replacing db0 to your choice for the database name. example kolli
  5. In terminal point to hsqldb folder i.e PATH
  6. Run the command on a terminal java -cp ./lib/hsqldb.jar org.hsqldb.server.Server
  7. Notice that I haven’t included any alias for the server, nor any -database.0 properties since they are being picked up from the server.properties file.
  8. It will Give the following Output[Server@12ac982]: [Thread[main,5,main]]: checkRunning(false) entered
    [Server@12ac982]: [Thread[main,5,main]]: checkRunning(false) exited
    [Server@12ac982]: Startup sequence initiated from main() method
    [Server@12ac982]: Loaded properties from [/{PATH}/hsqldb/server.properties]
    [Server@12ac982]: Initiating startup sequence…
    [Server@12ac982]: Server socket opened successfully in 14 ms.
    [Server@12ac982]: Database [index=0, id=0, db=file:kolli/kolli, alias=] opened sucessfully in 2555 ms.
    [Server@12ac982]: Startup sequence completed in 2577 ms.
    [Server@12ac982]: 2011-12-23 00:07:00.232 HSQLDB server 2.2.6 is online on port 9001
    [Server@12ac982]: To close normally, connect and execute SHUTDOWN SQL
    [Server@12ac982]: From command line, use [Ctrl]+[C] to abort abruptly
  9. Open Another new terminal and change directory to PATH.
  10. After this try connecting to the database by using the database manager, java -cp ./lib/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing
  11. A window will open like the one above, enter the parameters like the one above and we should be connected to the server. Once connected we can use the menu options to create tables. You have to know SQL syntax. Since we didn’t give any alias the URL is up until localhost only.
  12. pressing Ctrl C will shutdown the database. This mode of the server is persistent, hence if we start the server again, the changes are there and can be verified in the DatabaseManager (which of course has to be reconnected with the server).