如何以二进制形式编写hsqldb? [英] How to write hsqldb in binary form?

查看:68
本文介绍了如何以二进制形式编写hsqldb?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找Java中SQLite的良好替代品(兼容JDBC).我找到了hsqldb,这让我很满意,但是有一些问题.

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.

首先.当数据库大小为3-4GB时如何运行?仍要全部加载到RAM吗?

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
}

推荐答案

HSQLDB灵活,可以选择存储数据的方式.如果要将数据存储在磁盘表中,请使用CACHED表.最简单的方法是在连接URL中添加一个属性:

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

所有CREATE TABLE和类似的语句都存储在.script文件中.如果您不希望此文件为文本格式,请添加另一个属性:

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

这篇关于如何以二进制形式编写hsqldb?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆