mysql与pgsql升级转换_Java中的MySQL至Postgresql转换工具
Is there a Java tool that can convert mysql dump into postgresql dump available.
Googling got me this, https://github.com/maxlapshin/mysql2postgres. Which is a ruby gem.
In my current development environment installing Ruby is not allowed.
The versions used
Mysql 5.1
Postgres 8.2
Note: mysqldump --compatible=postgresql didnt work!
Thanks.
解决方案
First, PostgreSQL 8.2 is ancient and unsupported. Upgrade urgently. Read the release notes for each .0 version to find out about any compatibility issues you may face.
As for the conversion, you should generally do it in two phases. Convert and load the schema, then convert and load the data.
Generally automated tools wont do a good job converting database schemas. You should do a schema-only dump, run a conversion tool over it then hand-edit and hand-check it before loading it into PostgreSQL.
Once you have a schema that looks sane, do a data-only dump from MySQL and try loading that into a PostgreSQL instance with your converted schema loaded in it. mysqldump --compatible=postgresql may do a better job, though youll probably need additional flags too.
If you try it and still dont have any luck, consider following up with more detail. Report exact error messages not just "doesnt work" if you follow up.
Is there a Java tool that can convert mysql dump into postgresql dump available. Googling got me this, https://github.com/maxlapshin/mysql2postgres. Which is a ruby gem. In my current development environment installing Ruby is not allowed. The versions used Mysql 5.1 Postgres 8.2 Note: mysqldump --compatible=postgresql didnt work! Thanks. 解决方案 First, PostgreSQL 8.2 is ancient and unsupported. Upgrade urgently. Read the release notes for each .0 version to find out about any compatibility issues you may face. As for the conversion, you should generally do it in two phases. Convert and load the schema, then convert and load the data. Generally automated tools wont do a good job converting database schemas. You should do a schema-only dump, run a conversion tool over it then hand-edit and hand-check it before loading it into PostgreSQL. Once you have a schema that looks sane, do a data-only dump from MySQL and try loading that into a PostgreSQL instance with your converted schema loaded in it. mysqldump --compatible=postgresql may do a better job, though youll probably need additional flags too. If you try it and still dont have any luck, consider following up with more detail. Report exact error messages not just "doesnt work" if you follow up.