How to write hsqldb in binary form?

扶醉桌前 提交于 2019-12-25 07:34:13

问题


I'm searching a good (JDBC-compatible) replacement for SQLite in java. I've found hsqldb and it's quite satisfying me, but there are some questions.

First. How it operates when database size will be 3-4GB? Still load all to RAM?

Second. There said, it can support binary format, not only script. How can I enable it?

Class.forName("org.hsqldb.jdbcDriver");
PleaseHsqlUseBinaryFormat(); // What should I write here or somewhere else?
link = DriverManager.getConnection("jdbc:hsqldb:file:/tmp/mydatabase.hsql","sa","");
try
{
    // Work with database
}

回答1:


HSQLDB is flexible and allows you to choose how the data is stored. If you want the data to be stored in disk tables, use CACHED tables. The easiest way to do this is by adding a property to the connection URL:

jdbc:hsqldb:file:/tmp/mydatabase.hsql;hsqldb.default_table_type=cached

All CREATE TABLE and similar statements are stored in the .script file. If you don't want this file to be in text format, add another property:

jdbc:hsqldb:file:/tmp/mydatabase.hsql;hsqldb.default_table_type=cached;hsqldb.script_format=3

The Guide covers the different options:

http://hsqldb.org/doc/2.0/guide/management-chapt.html



来源:https://stackoverflow.com/questions/13432262/how-to-write-hsqldb-in-binary-form

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