This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes migrating a database to another programmatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "migrating a database to another programmatically" Watch "migrating a database to another programmatically" New topic
Author

migrating a database to another programmatically

Tiju Thomas
Greenhorn

Joined: May 25, 2008
Posts: 22
Is there any java utility to programmatically copy a database to another (say from sqlserver to derby)? I found org.apache.ddlutils but it suggests using ant. I wanted to do it programmatically using java. Any idea is helpful
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

There are plenty of off the shelf, comercial solutions but not many via an embedded library. In general, though, I've found it doesn't take much work to write one yourself for a specific task. If you use the meta data API, you can read a database and create a file of SQL create/insert commands, formatted for the new database. Then just call a bulk script on the file and load it into the new database. In general, converting a database is non-trivial process so doing it yourself gives you a lot of control of what goes to what.


My Blog: Down Home Country Coding with Scott Selikoff
Tiju Thomas
Greenhorn

Joined: May 25, 2008
Posts: 22
Scott Selikoff wrote:If you use the meta data API, you can read a database and create a file of SQL create/insert commands,


Thanks much Scott. How exactly we can create a file of SQL from the metadata? Do we have any code sample over the net anywhere?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: migrating a database to another programmatically
 
Similar Threads
Determined identity key value
Java Application, MS Access database
Printing from android
Invalidate CMP Caching for commit-option A
How to upload the file into another server