What is the difference between HSQLDB and JavaDB? Which one is suitable for unit testing?
Could you tell me the differences between HSQLDB and JavaDB? And which one should I use in unit testing, assumi开发者_StackOverflowng that I only use standard features? Thanks.
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).
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)
精彩评论