100%内存中的HSQL数据库 [英] 100% in-memory HSQL database

查看:142
本文介绍了100%内存中的HSQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Java应用程序设置为一项服务,每隔几个小时就对约3GB的数据进行数据挖掘.我希望这种情况在内存中发生100%.理想情况下,我希望将应用程序与所有事物隔离开来.我希望它构建数据库,进行我需要的挖掘,并在完成后拆除数据库.

I have a Java application set up as a service to do data-mining against ~3GB of data every few hours. I would like this to occur 100% in memory. Ideally I want the application to be isolated from everything; I want it to construct the database, do the mining I need, and tear down the database when it's done.

但是对于HSQLDB,即使我使用创建内存表...."命令,也会写入所有语句的日志,并在下次应用程序运行时重新创建该表.

However with HSQLDB, even when i use the "create memory table...." command, a log is written of all of the statements and the table is recreated the next time the application runs.

我正在做很多插入操作,大约150k +,因此该文件的大小会迅速增大.我也不关心在下次运行时重建数据库,因此日志记录对我来说毫无用处.

I'm doing a LOT of inserts, ~150k+, so this file will quickly grow in size. I also don't care about reconstructing the database upon next run, so the logging is useless to me.

完成后,我只可以删除文件,但是如果可能的话,我想避免将那么多的内容写到磁盘上.

I could just delete the file when I'm done, but if possible I'd like to avoid having to write that much to the disk.

有没有办法关闭此功能?

Is there a way to turn off this feature?

提前谢谢!

推荐答案

没问题,只需打开数据库连接即可:

No problem, just open the database connection thus:

 Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:aname", "sa", "");

有关更多信息,请参考 HSQL文档.

For more information, refer to the HSQL docs.

这篇关于100%内存中的HSQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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