• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

migrating a database to another programmatically

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Tiju Thomas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic