Rajesh
Rajesh

Reputation: 3034

is there any java plugin to generate DDL for Oracle,MySQL,PostGreSQL?

I am comparing two database in java using jdbc meta data. Steps followed in comparison is : Fist check for common schema->For all common schema found common table->for all common table find common column(considering column datatype,size,scale,isNull,orderInDB) ,check for primary key,foreign key.

Now If I note any difference in any property then I want to generate appropriate DDL so that I can execute on a database and make the two database equal.

Is there any java plugin which can help me out? Let me know any strategy which will be helpful in accomplishing this task.

Upvotes: 1

Views: 3874

Answers (3)

qwazer
qwazer

Reputation: 7531

For oracle you can use scheme2ddl from http://code.google.com/p/oracle-ddl2svn/ toolset

Upvotes: 0

Łukasz Rżanek
Łukasz Rżanek

Reputation: 5836

There is a marvelous Schemacrawler API kit, which does what you really need - parse DB schema and, if needed, create a diff-able output. I suggest You go with that, since it's very easy to use and there is a bunch of good snippets on the website.

Upvotes: 3

Mike Lin
Mike Lin

Reputation: 370

I encountered the same situation before, While my solution is to generate the DDL by myself. since you have all the metas for that table, you can easily generate it, isn't it? The key point is composite index. Besides, you also need to know the different types among these databases.

Upvotes: 0

Related Questions