HSQLDB Database Connection Close Doesn’t Write to Disk - Solution , HSQLDBhsqldb数据库连接关闭不写入到磁盘-解决方案
HSQLDB, the famous fast RDBMS written in Java, introduced a new feature which affects code ported over from previous versions. , HSQLDBhsqldb ,著名的快速RDBMS的书面Java中,引入了新的功能,影响代码携从先前的版本。 From version 1.7.2, in-process databases are no longer closed when the last connection to the database is explicitly closed via JDBC.从版本1.7.2 ,在过程数据库已不再是封闭,当最后数据库的连接是明确封闭,通过JDBC的。 Effectively your data is not written to disk even if you exit the program (say for database opened within application).有效您的数据是不写入磁盘,即使你退出程序(例如数据库开的应用) 。 Also it prevents opening the database next time around as a lock file (.lck) has been created to indicate that the data has not been commited to disk.此外,它可以防止开放数据库的时间大约在明年作为一个锁定文件( 。 lck )已建立表明,该数据并没有一直致力于磁盘。 There are two solutions to this issue.有两个办法解决这一问题。
You can either issue an explicit SHUTDOWN command through executeQuery.您可以发出明确的shutdown命令通过executequery 。 It will effectively shutdown the database and commit all data to disk.它将有效地关闭数据库,并承诺所有数据到磁盘。
A simpler way is to slightly alter your DriverManager.getConnection statement to ensure the database is closed after the last connection has been closed.一种更简单的方式是稍微改变您的drivermanager.getconnection声明,以确保该数据库是封闭后,最后连接已经关闭。 This is what I use -这是我的使用-
DriverManager.getConnection(”jdbc:hsqldb:file:” + database + “ ;shutdown=true “, “sa”, “”); drivermanager.getconnection ( “ JDBC的: , HSQLDBhsqldb :文件: ” +数据库+ “ ; 关机=真正的 ” , “ SA服务” , “ ” ) ;
Filed under提起下 Database数据库 , , How To如何 , , Java Software Java软件 , , RDBMS RDBMS的 , , Tech Note技术说明 | |
| |
RSS 2.0 2.0 | |
Email this Article电子邮件此文章
You may also like to read您也可以想读 |





July 16th, 2006 at 6:46 am 2006年7月16日在上午06时46分
[...] [ … … ] http://blog.taragana.com/index.php/archive/hsqldb-database-connection-close-doesnt-write-to-disk-solution/ [...] [ … … ]