HSQLDB - which is the main database file

荒凉一梦 提交于 2021-02-06 15:48:17

问题


I am using HSQLDB in the embedded mode.

jdbc:hsqldb:file:abc\\TESTDB;

After creating the database, the folder abc has the following files:

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?


回答1:


.script contains 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 .data as other people already said

.lck is 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.

.log contains internal log statements of running transactions for example and some commit or rollback points.

.properties contains 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.

kind regards




回答2:


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.

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.




回答3:


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:

http://hsqldb.org/doc/guide/apc.html

http://hsqldb.org/doc/guide/ch04.html



来源:https://stackoverflow.com/questions/6471969/hsqldb-which-is-the-main-database-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!