1

I have to convert a mysql-database into a java (derby) database. This works fine with ant-tasks, absolutely no problem. Unfortunately not all the tables out of the orginin-database may be used in the target-database. As i found no chance to filter tables by name in the ant-tasks of ddlUtils, i consider to write a small java-application using ddlUtils.jar.

But trying this, i am not even able to extract schema and data out themysql-database. The examples in the ddlUtils-api explain to less for a beginner like me.

Is there a more comprehensive example how to deal with this Problem?

My Plan was to split the work into this steps:

  • getting the db-schema from the origin-database (filtered by TableNames)
  • getting the data from the origin-database (filtered by TableNames)
  • creating the schema in the target-database (Java) by using the reduced db-schema
  • inserting the data in the target-database by using the reduced content.

In the api-section "Read the model from a live database" is the method platform.readModelFromDatabase(String) used for this action, but i was not able to instantiate a Platform-object by now which let me call the method without lots of exceptions.

lots of thanks Alf

1 Answers1

3

Well 6 months without an answer .. If you're still interested I was trying to find resources on the web about DdlUtils but unfortunately they were very poor. But these sites helped me to find a way to start:

http://www.sienaproject.com/documentation-jdbc.html

http://codeblow.com/questions/database-migration/

http://numberformat.wordpress.com/tag/ddlutils/

I'm using this code to initialize the MySQL instance:

    MySqlPlatform platform = (MySqlPlatform) PlatformFactory.createNewPlatformInstance(datasource);

Hope it helps!

Felipe Duarte
  • 1,079
  • 14
  • 20