Search code examples
javajdbcopen-sourcedatabase-schemaddl

JDBC based tools to import / export database schema


I'm about to write a JVM based open sourced tool that needs to have a model of a database schema including tables, columns, primary keys, foreign keys and column attributes (datatype, nullable, auto increment etc). I'd like to use an existing framework rather that re-inventing the wheel.

I've done a bit of googling and have found apache DDLUtils which looks like it will do the job. I'd like to assess all the options would like to hear of any frameworks that can do the following:

  1. Interrogate an existing database via JDBC and construct an in memory schema model
  2. Export an in memory schema model to a file (XML or JSON etc).
  3. Create a new database from a schema model via JDBC
  4. Import a schema file to an in memory schema model
  5. Support for multiple databases (Oracle, MS Sql Server, H2, MySql etc).
  6. Open source license

Also, I'd like to hear of any standardised file formats for storing the schema model. DDLUtils mentions the Turbine XML format.


Solution

  • I ended up writing my own services with overridable seams that reference java.sql.DatabaseMetaData by default.