Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Best way to copy table from one database to any other database

843859Apr 1 2007 — edited May 24 2007
I need to write an application to perform database table copy from one kind of database to another kind of database.
I just wrote a simple JDBC program which essentially does the something like below:

PreparedStatement statement = null;
ResultSet rs = null;

try
{
System.out.println("insertSQL:" + insertSQL.toString());
statement = target.prepareStatement(insertSQL.toString());
System.out.println("selectSQL:" + selectSQL.toString());
rs = source.executeQuery(selectSQL.toString());

int rows = 0;

while (rs.next())
{
rows++;
for (int i = 1; i <= columns.size(); i++)
{
statement.setString(i, rs.getString(i));
}
statement.execute();
}

System.out.println("Copied " + rows + " rows.");

But problem with this one is that it takes lot of time( more than 60 mins) for 100k records transfer. Would there be any faster way to do this?

TIA...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2007
Added on Apr 1 2007
5 comments
1,174 views