Ramin Moazeni wrote:
> Hello,
> 
> I am a Google Summer of code participant working on the Derby
> Migration tool project. The High level design document is posted at
> http://wiki.apache.org/db-derby/MysqlDerbyMigration/DesignDocument

It's great to see you doing this!

> There are 2 approaches described in the document -- one based on the use
> DatabaseMetaData class and the other is based on the use ddlUtils tool
> (http://db.apache.org/ddlutils) which is also an apache project.

In the "Approach 2: Using DdlUtils" section of
http://wiki.apache.org/db-derby/MysqlDerbyMigration/DesignDocument ,
there is this description:

   In order to use DdlUtils component to migrate the source database
   to the target database, following steps are suggested:

    * Capture DDL file from DdlUtils.
    * Modify the source DDL to the target DDL using Serialization and
Deserialization of XML.
    * Fed in the new DDL file to the DdlUtils.

If the intent is to use the XML DDL file generated by DdlUtils,
technically there should be no need to modify it for the target database
-- except that there are a few issues that would need to be watched for,
such as Derby doesn't support a boolean type. At any rate, the Java app
can read the database model from the XML file, or even from the "live
database" (see
http://db.apache.org/ddlutils/api-usage.html#Reading+the+model+from+a+live+database
), then write that database model to the target. The DdlUtils code takes
care of producing the SQL required to create the tables in the new database.

> Please note that the DdlUtils doesn’t support non-table entities, 
> constraints, triggers, stored procedures, etc. 

DdlUtils supports primary and foreign key constraints, but not check
constraints.

Given its limitations, your DatabaseMetaData approach might be more
complete. But if you can use any pieces from DdlUtils, you should feel
free to do so (with all the correct attributions, of course) since it is
under the ASL 2.0.

 -jean


Reply via email to