MySQL 转储 .sql 脚本并导入到 apache derby
所以大概 mysqldump 可以导出到 ansi 兼容 格式,以便您可以导入到其他供应商的数据库。
然而,在尝试导入 apache derby 时,我遇到了所有这些语法错误。 我想尝试一些正则表达式并修复问题,但似乎不止几个。
我对 mysqldump 有什么遗漏吗? 尝试了 ddlutils 但在步骤 3 后无法使用这些 docs 似乎已经过时了。
我还有其他选择吗?
So presumably mysqldump can export to ansi compatible format so that you can import to other vendors' databases.
However trying to import to an apache derby I face all this syntax errors.
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?
Tried ddlutils but couldn't make progress after step 3 with these docs which seem out of date.
Do I have any other options with that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
mysqldump
选项--兼容=ansi
不会生成完全 ANSI 兼容的 SQL 脚本,它只是尝试生成以下结果: 更 ANSI 兼容:“生成与其他数据库系统或较旧的 MySQL 服务器更兼容的输出。”不幸的是,每个数据库支持的 SQL 语法有点不同。 SQL 是一个相对较弱的标准,比 Javascript 甚至 C 都弱得多。一些数据库支持兼容性功能,例如 MySQL,甚至 兼容模式(免责声明:我是H2的主要作者),但有时这还不够。
您有多种选择:您可以手动更改生成的 SQL 脚本,或者您可以使用其他工具来复制表结构/数据。其中一个工具是 SQuirreL DB Copy Plugin (我从未真正使用过它,但据我所知效果很好)。
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."Unfortunately, the SQL syntax supported by each database is a bit different. 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.
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. One such tool is the SQuirreL DB Copy Plugin (I have never actually used it, but from what I heard it works well).
如果您可以以 CSV 格式或类似格式导出数据,那么您可以使用 Derby 数据导入过程来导入数据: http://db.apache.org/derby/docs/10.7/ref/rrefimportproc.html
If you can export your data in CSV format, or something similar, then you can use the Derby data import procedures to import your data: http://db.apache.org/derby/docs/10.7/ref/rrefimportproc.html