HSQLDB not persisting in file mode

Hyper SQL DB (or HSQLDB for short) is a great java-based database system that performs exceptionally well, even though just consuming a few hundred KB. It is very convenient for integration testing and has loads of useful modes to work with. One of the modes that are suitable for light testing in development is the file mode, where persistance basically just works by writing INSERT statements to a script file. Unfortunately, this mode gave me a lot of unexpected grief due to not persisting data, and I am certainly not the only one (link1).

To get it working I just needed to add the following to the connection url: «hsqldb.write_delay=false;»
Beware: this only works on HSQL versions >= 2.0

The relevant part of my hibernate.cfg.xml now looked like this:

<property name="connection.url">

Other people have come up with other solutions, so if this does not work for you, then do check their work out


2 Responses to HSQLDB not persisting in file mode

  1. fivig sier:

    Can you post working example of hibernate annotation+ hsqldb in file mode persist date? I can’t do that(((

  2. Carl-Erik sier:

    Sorry, but I have not used annotations with Hibernate. I have just used simple xml configuration files. I have no idea how to do that (yet), but might get to it once I start reading «Spring persistance with Hibernate» (Fisher, Murphy).

Legg igjen en kommentar

Fyll inn i feltene under, eller klikk på et ikon for å logge inn:


Du kommenterer med bruk av din WordPress.com konto. Logg ut /  Endre )


Du kommenterer med bruk av din Google+ konto. Logg ut /  Endre )


Du kommenterer med bruk av din Twitter konto. Logg ut /  Endre )


Du kommenterer med bruk av din Facebook konto. Logg ut /  Endre )


Kobler til %s

%d bloggere like this: