以编程方式嵌入Java h2数据库 [英] Embedding the Java h2 database programmatically

查看:232
本文介绍了以编程方式嵌入Java h2数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我们使用 HSQLDB 作为嵌入式数据库,但我们搜索的内存占用较少的数据库随着数据量的增长。

At the moment we use HSQLDB as an embedded database, but we search for a database with less memory footprint as the data volume grows.

Derby / JavaDB < a>现在不是一个选项,因为它将属性全局存储在系统属性中。因此,我们想到了 h2

当我们使用HSQLDB时,我们创建了一个Server对象,设置参数并启动它。这在此处中描述(并且在org.hsqldb.test类中作为示例给出.TestBase)。

While we used HSQLDB we created a Server-object, set the parameters and started it. This is described here (and given as example in the class org.hsqldb.test.TestBase).

问题是:这可以类似于h2数据库吗?你有任何代码示例吗?

The question is: Can this be done analogous with the h2 database, too? Do you have any code samples for that? Scanning the h2-page, I did not find an example.

推荐答案

在下载中,我看到文件tutorial.html有这个

From the download, I see that the file tutorial.html has this

import org.h2.tools.Server;
...
// start the TCP Server
Server server = Server.createTcpServer(args).start();
...
// stop the TCP Server
server.stop();

这篇关于以编程方式嵌入Java h2数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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