Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you copy data from one database to another

 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation where I need to copy 300,000 rows of data from a table on a database to a similar table on another database .
Could someone suggest a performance oriented JDBC solution to achieve this ?
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it have to be through JDBC?
If not, you could try the export and import functions of the DBMS(es) in question.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a JDBC solution, remember to turn auto-commit off first.
conn.setAutoCommit(false);
Then when you're done copying the rows, remember to commit.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic