HSQLDB是否有某种机制可以将内存中的数据保存到文件中? [英] Has HSQLDB some mechanism to save in-memory data to file?
问题描述
HSQLDB是否有某种将内存中的数据保存到文件的机制?
Has HSQLDB some mechanism for saving in-memory data to file?
据我所知,在服务器关闭后,所有内存中的数据都变得不可访问.所以我想将所有内存中的数据保存到文件中. 不幸的是,我不能使用BACKUP机制,因为它不能应用于内存中的数据.
As I know after the server is shutted down, all in-memory data become unaccessible. So I want to save all in-memory data to file. Unfortunately I can't use BACKUP mechanism, because it can't be applied for in-memory data.
推荐答案
HSQLDB数据库具有不同的类型.全内存数据库不将数据存储到磁盘.这些数据库的URL格式为jdbc:hsqldb:mem:<name>
.
HSQLDB databases are of different types. The all-in-memory databases do not store the data to disk. These databases have URLs in the form jdbc:hsqldb:mem:<name>
.
如果数据库URL的格式为jdbc:hsqldb:file:<file path>
,并且表是默认的MEMORY表,则数据全部在内存中,但是更改将写入一组磁盘文件中.
If your database URL is in the form jdbc:hsqldb:file:<file path>
and your tables are the default MEMORY tables, the data is all in memory but the changes are written to a set of disk files.
对于包括all_in_memory在内的所有类型的数据库,您可以使用SQL语句SCRIPT <file path>
将整个数据库保存到文件中.如果将数据保存到扩展名为.script
的文件中,则可以将该文件作为文件数据库打开.
With all types of database, including all_in_memory, you can use the SQL statement SCRIPT <file path>
to save the full database to a file. If you save the data to a file with the .script
extension, you can open the file as a file database.
运行服务器时,使用URL时不带jdbc:hsqldb
前缀,例如server.database.0=file:C:/myfile
When you run a server, the URL's are used without the jdbc:hsqldb
prefix, for example server.database.0=file:C:/myfile
在此处查看指南 http://hsqldb.org/doc/2.0/guide /running-chapt.html#running_db-sect
这篇关于HSQLDB是否有某种机制可以将内存中的数据保存到文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!