简体   繁体   English

如何使用JDBC将Derby数据库导出到sql插入文件

[英]How to export Derby database to sql insert file using JDBC

I am trying to extract the current database to a .sql insert file. 我正在尝试将当前数据库提取到.sql插入文件。 I am using IntelliJ and a Derby embedded database. 我正在使用IntelliJ和Derby嵌入式数据库。 I know how to do this manual through IntelliJ, but I want to do so through JDBC. 我知道如何通过IntelliJ来完成本手册,但是我想通过JDBC来完成。 I would like to store the file within the project as well, so it can be ran as a sql script to insert to the db later on. 我也希望将文件存储在项目中,因此以后可以将其作为sql脚本运行以插入到db中。

It's not possible to extract a Derby database to a .sql file that can be ran later on. 无法将Derby数据库提取为.sql文件,以后可以运行该文件。

Instead, simply zip up your Derby database folder and unzip it later on. 相反,只需压缩您的Derby数据库文件夹,然后再将其解压缩。

http://db.apache.org/derby/docs/10.0/manuals/admin/hubprnt43.html#Backing+Up+a+Database http://db.apache.org/derby/docs/10.0/manuals/admin/hubprnt43.html#Backing+Up+a+Database

There is no option for backup as sql file format. 没有备份为sql文件格式的选项。 However, to perform an offline backup of a database, simply use operating system commands to copy the database directory. 但是,要执行数据库的脱机备份,只需使用操作系统命令来复制数据库目录。 The database must be shut down prior to performing an offline backup. 在执行脱机备份之前,必须关闭数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM