You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Feng Jiang <fe...@gmail.com> on 2006/11/22 15:31:30 UTC

how to migrate mysql to derby

Hi,

I want to use derby to write some testcases in memory. now, i have a mysql
database, and dumped the schema into a script file. Here i want to execute
this script file and create a identitcal database schema with that mysql
database.

best regards,

Feng

Re: how to migrate mysql to derby

Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Feng Jiang wrote:
> Hi,
> 
> I want to use derby to write some testcases in memory. now, i have a mysql
> database, and dumped the schema into a script file. Here i want to execute
> this script file and create a identitcal database schema with that mysql
> database.

One option might be to use DdlUtils to create the derby schema from the
mysql database; a derby example is at
http://db.apache.org/derby/integrate/db_ddlutils.html. It shows how to
migrate between two derby databases, but it should work between any
databases that DdlUtils supports.

It uses the DdlUtils ant tasks to create the schema in the target
database from the XML files created from the source database (all
generated by DdlUtils). If you specifically want a SQL script that will
work with derby, DdlUtils has a writeSchemaSqlToFile ant task [1].

Do you want to just create the schema? Or do you also want to load data?

 -jean

[1]
http://db.apache.org/ddlutils/ant-tasks.html#Subtask%3A+writeSchemaSqlToFile