Database copy tool
Consider two potentially differing database systems e.g. Postgresql™ and Mysql™.
- Source database:
-
Hosting an active instance i.e. a set of tables containing data records and optionally views.
- Destination database
-
Yet empty or containing non-conflicting table and view names.
We assume full JDBC™ read access to our source database and full read/write access to the destination database.
-
Source to destination copy addressing vendor specific SQL syntax rules.
-
Transfer as many integrity constraints as possible:
-
Differing data types.
-
null/not nullconstraints. -
Column default values.
-
Primary / candidate key constraints.
-
Foreign key constraints.
-
Check constraints.
-
-
null/not nulldefaults may differ on both database systems. -
The destination database may be a non-SQL database like Mongodb supporting a limited subset of schema constraints. A copy tool thereby supports database migration.
Tip
Useful technologies:
-
JDBC in general and ResultSetMetaData.html + friends in particular.
-
The tool may be implemented as a CLI application using a standard command line option handling parser. See CLI Comparison as well.
