Read data from one database and store it in other database Read data from one database and store it in other database database database

Read data from one database and store it in other database


Make a stored procedure in the local database that does the copying from the local database to the remote database. Call that stored procedure from your Java program.

This is possible only if your database implementation supports linking to remote databases from a different implementation.


If i talk in oracle you can create a db link in the destination DB say source_link

http://docs.oracle.com/cd/B28359_01/server.111/b28310/ds_concepts002.htm

Then connect to the destination DB

insert into A (field1,field2,...) select field1,feild2.... from A@source_link where

Nothing to do with Java but a efficient way too


You can use ETL (Extract/Transfer and Load) . Spoon is a free tool that you can create transformations purely using SQL to perform this type of a task.

http://kettle.pentaho.com/

http://wiki.pentaho.com/display/EAI/Spoon+User+Guide

http://rpbouman.blogspot.com.au/2006/06/pentaho-data-integration-kettle-turns.html