File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Connection between two databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connection between two databases" Watch "Connection between two databases" New topic

Connection between two databases

njava nDeveloper

Joined: May 26, 2010
Posts: 1
Hi, I am using two databases.My database is DB2 So in my java code I make a connection1 for SAMPLE1. Now connection is made specifying the Database its db1 in this case.

Now for second database SAMPLE2 i am using another connection2. After making successful connections I want to pass data between two database. So I want to fetch data from DB sample1 with "select * from emp" and insert this into another DB sample2's emp table with insert query. I am doing this in java.

If it had been same database we could have used "Insert into emp select * from emp" but as these are two different DBs and two different connections its difficult to communicate.

Does anyone know if there we can use some common driver/connection object between two different DBs ? Or is there any other way to manipulate between two databases using a common or combined connection object ?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Maybe something like this: ?

Generally, the search term you're looking for is "JDBC ETL tool" (for Extract, Transform, Load).
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

hmm, where have i heard of that before...
I need to get back to that soon. So much uncommitted code!
I agree. Here's the link:
subject: Connection between two databases
It's not a secret anymore!