简体   繁体   English

MySQL转储.sql脚本并导入到Apache derby

[英]MySQL dump .sql script and import to an apache derby

So presumably mysqldump can export to ansi compatible format so that you can import to other vendors' databases. 因此,大概mysqldump可以导出为ansi兼容格式,以便您可以导入其他供应商的数据库。

However trying to import to an apache derby I face all this syntax errors. 但是,尝试导入到Apache德比中时,我遇到了所有这些语法错误。 Thought I try some regex and fix things but it seems that there are more than a couple. 以为我尝试了一些正则表达式并修复了问题,但似乎还有很多。

Is there something I'm missing about mysqldump? 关于mysqldump我缺少什么吗? Tried ddlutils but couldn't make progress after step 3 with these docs which seem out of date. 尝试了ddlutils,但在第3步之后无法使用这些似乎过时的文档取得进展。

Do I have any other options with that? 我还有其他选择吗?

The mysqldump option --compatible=ansi doesn't produce a SQL script that is fully ANSI compatible, it just tries to produce a result that is more ANSI compatible: "Produce output that is more compatible with other database systems or with older MySQL servers." mysqldump选项--compatible=ansi不会生成与ANSI 完全兼容的SQL脚本,它只会尝试生成与ANSI 更加兼容的结果:“生成与其他数据库系统或旧版MySQL服务器更兼容的输出”。

Unfortunately, the SQL syntax supported by each database is a bit different. 不幸的是,每个数据库支持的SQL语法都有些不同。 SQL is a relatively weak standard, much weaker than Javascript or even C. Some databases support compatibility features like MySQL does, or even compatibility modes (disclaimer: I'm the main author of H2), but even this is not enough sometimes. SQL是一个相对较弱的标准,比Java甚至C语言都弱得多。某些数据库支持MySQL等兼容功能,甚至支持兼容模式 (免责声明:我是H2的主要作者),但是有时这还不够。

You have multiple options: you could change the generated SQL script by hand, or you could use another tool to copy the table structure / data. 您有多种选择:可以手动更改生成的SQL脚本,也可以使用其他工具复制表结构/数据。 One such tool is the SQuirreL DB Copy Plugin (I have never actually used it, but from what I heard it works well). 这样的工具之一就是SQuirreL DB Copy插件 (我从未真正使用过它,但是据我所知它运行良好)。

如果可以CSV格式或类似格式导出数据,则可以使用Derby数据导入过程来导入数据: http : //db.apache.org/derby/docs/10.7/ref/rrefimportproc.html

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

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