views:

56

answers:

2

Could you tell me the differences between HSQLDB and JavaDB? And which one should I use in unit testing, assuming that I only use standard features? Thanks.

+2  A: 

HSQLDB is faster, therefore it is better suited for unit testing.

The H2 Database is even better (in my view): it's as fast as HSQLDB, and supports compatibility modes for various databases (MySQL, Oracle,...). So if you need to use database specific features in the future, chances are that you can still test it with H2. But my view is a bit biased (see my profile).

Thomas Mueller
+1  A: 

HSQLDB has features that are useful for testing and not available in JavaDB. These include

  • database script and log in SQL text format allows quick check of test runs
  • user-defined SQL functions that allow you to write an equivalent to any function supported by another database very simply
  • very extensive set of SQL features and functions, for example date and interval arithmetic as supported by DB2 and ORACLE (also PostgreSQL and MySQL) and functions such as TO_DATE

BTW, the above features are not available in H2 (mentioned in another answer)

fredt