something funny with embedded hsql

自作多情 提交于 2019-12-06 14:03:37

Using HSQLDB for development and testing is discussed in detail in the new Guide.

http://hsqldb.org/doc/2.0/guide/deployment-chapt.html#dec_app_dev_testing

HSQLDB uses a write delay mechanism by default and changes are flushed to disk after 10 seconds in version 1.8.x or 0.5 sec in version 2.0 and later.

You can force the database to shutdown and write all the changes when the last connection is closed with this URL:

jdbc.url=jdbc:hsqldb:file:mydb;shutdown=true

With HSQLDB 2.x you can use the write_delay property to force each commit to write to disk immediately:

jdbc.url=jdbc:hsqldb:file:mydb;hsqldb.write_delay=false

Version 2.2.9 and later persist the latest changes when the last connection is closed, so it may not be necessary to use hsqldb.write_delay=false for tests that close the connections.

With HSQLDB 1.8, you need to run an SQL command at the beginnig to do this:

SET WRITE_DELAY FALSE

By default, HSQLDB keeps table contents in memory until the database is shut down: http://www.hsqldb.org/doc/guide/ch05.html#N10DD6

Depending on your needs (eg, working in a development environment) this may be sufficient. For production, however, I'd rather use a DBMS that writes each change to disk in multiple places (which for my means Oracle, although MySQL probably works just as well).

Why don't you just set the show_sql property to true if you want to see what hibernate does?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!