HSQLDB重启后清除表数据
我想在内存中保存一些临时数据,这些数据应该在服务器关闭后删除。
HSQLDB中有一个临时表,但是事务提交后数据立即被删除,这对我来说太短了。另一方面,内存表保存脚本日志文件,并在服务器新启动时恢复数据。维护这样的脚本日志需要时间和地点,这对我的情况毫无用处。
我需要的只是一种表,只有表结构持久在硬盘中,数据和数据操作只能在内存中执行。否则为什么我需要内存数据库而不是 mysql?
HSQLDB中有这种类型的表吗?
谢谢
I want to save some temporary data in memory, which should be removed after server shuts down.
There is a temporary table in HSQLDB, but the data is removed immediately after transaction committed, which is too short for me. On the other side, the memory table keeps a script log file and resume the data when server new starts. It takes time and place to maintain such script logs, which are useless for my situation.
what I need is just a type of table, only the table structure is persistent in hard disk, the data and the data operations should only be performed in memory. Otherwise why do I need a in-memory DB instead of mysql?
Is there such type of table in HSQLDB?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建文件:数据库,然后创建表。执行关机。编辑数据库的 .properties 文件,添加以下设置并保存。
当您使用此数据库执行测试时,不会将任何数据写入磁盘。
或者,使用最新版本的 HSQLDB 2.2.x,您可以在测试期间在连接 URL 上指定此属性。例如
Create the file: database, then create the tables. Perform SHUTDOWN. Edit the .properties file for the database, add the setting below and save.
When you perform your tests with this database, no data is written to disk.
Alternatively, with the latest versions of HSQLDB 2.2.x, you can can specify this property on the connection URL during the tests. For example