Tuesday, May 10, 2011

Remember to shutdown your database

I was working on a project which uses Spring, Jdbc, Jpa and HSQLDB.

It is meant to be executed as a batch program from command line with multi threaded support.

After a while, I noticed that my final few commits to the database is never captured properly by the database. After checking to see if my threads, jpa or spring context is closed properly, I finally figured out it is because I never shutdown my HSQLDB properly. Even though I am using it as a file based database, I must still issue a shutdown command.

For those of you trying to work with embedded database, do remember to shut it down when your program exits.

Hopes this kind reminder will safe you hours of debugging.