mysql转储到derby
我在 eclipse 中使用 derby 进行开发。是否可以从 MySQL 转储表并以某种方式将其用于 derby?我知道 ddl & dml 对于两个 dbms 来说都是不同的,但我正在寻找一种除了转储/导出之外的合适方法。
I'm using derby for development in eclipse. Is it possible to dump a table from MySQL and use it for derby in some way? I know that ddl & dml are different for both dbms but I'm looking for a way, other than dump/export, that would be appropriate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可以找到两种选择;如果我正确理解你的问题,我认为至少有一个可以涵盖你正在寻找的内容。
如果您的重点是单个表中的数据(或其子集),请使用
ij
,如 Derby 工具文档(请参阅“使用批量导入和导出过程”)。可以使用所需格式的内部格式化命令从 MySQL 中提取数据,这似乎是非常标准的 CSV(这需要您的 Derby 数据库中已有一个适当的表)。以下是来自 MySQL 论坛的示例:
如果您想导入所有内容,Apache DdlUtils 将允许传输从 MySQL 到 Derby 的整个模式。这不需要在 Derby 中重复表定义,因为它会作为 DdlUtils 导入/导出过程的一部分出现。
There are two options I can find; if I understand your question correctly, I think at least one will cover what you are looking for.
If your focus is the data (or a subset thereof) from a single table, use
ij
as indicated in the Derby tools documentation (see "Using the bulk import and export procedures"). The data can be extracted from MySQL using intrinsic formatting commands in the required format, which appears to be pretty standard CSV (this would require that you have an appropriate table already existing in your Derby database).Here's an example from the MySQL forums:
If you want to import everything, Apache DdlUtils will allow the transfer of an entire schema from MySQL to Derby. This would not require the repeated table definition in Derby, as it would come across as part of the import/export process with DdlUtils.
除非您需要自动化该过程,否则“SQuirreL SQL 客户端的 DBCopy 插件”工具可能适合您。可能还有其他工具,但这是我所知道的工具(但我自己从未使用过)。
如果您确实需要自动化该过程,并且您不太关心 DDL,那么我可能会使用 CSV。
Unless you need to automate the process, the "DBCopy Plugin for SQuirreL SQL Client" tool might work for you. There are probably other tools, but that's the one I know (however never used myself).
If you do need to automate the process, and if you don't care so much about the DDL, then I would probably use CSV.
为了将数据从MySQL(生产环境)接管到Derby(开发环境),我使用以下命令:
但特别是在Derby中,我还遇到了解除约束的问题。因此,插入语句必须按正确的顺序!
To take over the data from MySQL (production environment) to Derby (development environment), I use following command:
But specially in Derby, I have also the problem of disalbing constraints. Therefore, the insert statements have to be in the correct order!