gpt4 book ai didi

java - 恢复h2数据库

转载 作者:行者123 更新时间:2023-12-02 12:19:43 24 4
gpt4 key购买 nike

我已将 h2 数据库用于基于桌面的应用程序(使用 swing)。我还备份了它并将其存储在我的文件系统中,扩展名为“.h2.db”。这不是一个可读文件。那么如何恢复我的 h2 备份文件呢?

最佳答案

建议使用特定工具创建 ZIP 文件。也应该可以在复制的文件上使用该工具:

The recommended way to backup a database is to create a compressed SQL script file. This will result in a small, human readable, and database version independent backup. Creating the script will also verify the checksums of the database file. The Script tool is ran as follows:
java org.h2.tools.Script -url jdbc:h2:~/test -user sa -script test.zip -options compression zip

然后可以使用 ZIP 文件来恢复数据库:

To restore a database from a SQL script file, you can use the RunScript tool:
java org.h2.tools.RunScript -url jdbc:h2:~/test -user sa -script test.zip -options compression zip

http://h2database.com/html/tutorial.html#upgrade_backup_restore

关于java - 恢复h2数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45868946/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com