java HSQLDB - 这是主数据库文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6471969/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HSQLDB - which is the main database file
提问by Vivek
I am using HSQLDB in the embedded mode.
我在嵌入式模式下使用 HSQLDB。
jdbc:hsqldb:file:abc\TESTDB;
After creating the database, the folder abc
has the following files:
创建数据库后,文件夹中abc
有以下文件:
TESTDB.lck TESTDB.script TESTDB.log TESTDB.properties
My application is working properly
我的应用程序运行正常
But my question is which is the main database file amongst the above-listed files?
但我的问题是上面列出的文件中哪个是主数据库文件?
Or is the main database file stored in some other location?
还是主数据库文件存储在其他位置?
回答by peshkira
.scriptcontains all the statements to create the tables, alter them and insert the data. This file is created when you use hsqldb in memory. (so I'd say this is your database) Otherwise the database is stored in .dataas other people already said
.script包含用于创建表、更改表和插入数据的所有语句。该文件是在内存中使用 hsqldb 时创建的。(所以我会说这是你的数据库)否则数据库存储在.data 中,正如其他人已经说过的
.lckis the lock file by which hsqldb knows whether the database is locked by a process. Usually you have this file only while your program is running and it is automatically deleted when you stop the programm.
.lck是锁定文件,hsqldb 通过它知道数据库是否被进程锁定。通常只有在程序运行时才有这个文件,当你停止程序时它会自动删除。
.logcontains internal log statements of running transactions for example and some commit or rollback points.
.log包含运行事务的内部日志语句以及一些提交或回滚点。
.propertiescontains the properties with which hsqldb is initialized (better don't change anything there if you don't know what you are doing). This is not to be confused with and persistence unit configuration.
.properties包含初始化 hsqldb 的属性(如果您不知道自己在做什么,最好不要更改那里的任何内容)。这不要与持久性单元配置混淆。
kind regards
亲切的问候
回答by Perception
A file containing your actual data might not exist in your folder for various reasons - particularly if you are using in-memory or non-cached tables. HSQLDB uses the various files you found in its working folder for a variety of reasons. You can read more about their purpose here: HSQLDB Reference.
由于各种原因,包含实际数据的文件可能不存在于您的文件夹中 - 特别是在您使用内存或非缓存表时。HSQLDB 出于各种原因使用您在其工作文件夹中找到的各种文件。您可以在此处阅读有关其用途的更多信息:HSQLDB 参考。
I paraphrase some of the more relevant information:
我转述一些更相关的信息:
The script file contains the definition of tables and other database objects, plus the data for non-cached tables. The log file contains recent changes to the database. The data file contains the data for cached tables and the backup file is a zipped backup of the last known consistent state of the data file. All these files are essential and should never be deleted. If the database has no cached tables, the test.data and test.backup files will not be present. In addition to those files, HSQLDB database may link to any formatted text files, such as CSV lists, anywhere on the disk.
While the "test" database is operational, a test.log file is used to write the changes made to data. This file is removed at a normal SHUTDOWN. Otherwise (with abnormal shutdown) this file is used at the next startup to redo the changes. A test.lck file is also used to record the fact that the database is open. This is deleted at a normal SHUTDOWN. In some circumstances, a test.data.old is created and deleted afterwards.
脚本文件包含表和其他数据库对象的定义,以及非缓存表的数据。日志文件包含最近对数据库的更改。数据文件包含缓存表的数据,备份文件是数据文件最后已知一致状态的压缩备份。所有这些文件都是必不可少的,不应删除。如果数据库没有缓存表,则不会出现 test.data 和 test.backup 文件。除了这些文件之外,HSQLDB 数据库还可以链接到磁盘上任何位置的任何格式化文本文件,例如 CSV 列表。
当“测试”数据库运行时,test.log 文件用于写入对数据所做的更改。该文件在正常关机时被删除。否则(异常关闭)该文件在下次启动时用于重做更改。test.lck 文件还用于记录数据库已打开的事实。这在正常 SHUTDOWN 时被删除。在某些情况下,之后会创建和删除 test.data.old。
回答by AhmetB - Google
I think you should have a .data
file after adding records to database. In the case I'm wrong here are the documentation for you:
我认为.data
在将记录添加到数据库后你应该有一个文件。如果我错了,这里是您的文档:
http://hsqldb.org/doc/guide/apc.html
http://hsqldb.org/doc/guide/apc.html