This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes  transfer data from one DB to another DB ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark " transfer data from one DB to another DB ?" Watch " transfer data from one DB to another DB ?" New topic
Author

transfer data from one DB to another DB ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1368
How to transfer data from one DB to another DB using JDBC?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
While it wouldn't be hard to write JDBC code that does a SELECT in one DB, and then an INSERT into the other DB, that's not the best approach. Just about all DBs have their own facilities for bulk-exporting and bulk-importing data; that area is called ETL (extract, transform, load) - check the documentation of the involved DBs for what they support.


Ping & DNS - updated with new look and Ping home screen widget
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1368
I guess ETL is third party product like Informatica. It is not part of the DB. I want the option that's part of the DB or thru JDBC.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
No, ETL is a tool category; check its Wikipedia page if you're unsure about the term. There are certainly 3rd party products for this, but:
Just about all DBs have their own facilities for bulk-exporting and bulk-importing data ... check the documentation of the involved DBs for what they support.
april henry
Greenhorn

Joined: Jan 18, 2010
Posts: 9
Hi,
You can try to use the following code:


select 'insert into tb_08 select '+rtrim(id) +','''+name+'''' from tb_08
/*
insert into tb_08 select 1,'b'
insert into tb_08 select 2,'b2'
*/

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: transfer data from one DB to another DB ?
 
Similar Threads
Which design pattern to use?
DAO & DTO Difference?
Serialization in Java
Transfer Huge data using Java
copy of files