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!

Inserting ResultSet into table

843859Mar 2 2009 — edited Mar 10 2009
Hi, i'm new to jdbc. Is there any possibility to insert ResultSet objects into table? Suppose i have to migrate data from oracle to postgre. Look the following code:
Connection con_ora = Oracle.getOracleConnection();
Connection con_postgre = Postgre.getPostgreConnection();

Statement stmt = con_ora.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM test");

while(rs.next()) {
   postgre_stmt.executeUpdate("INSERT INTO test values " + rs );  
rs here is an object and cannot be inserted this way. Assuming that table structure is identical in oracle in postgre is it possible to insert resultset object this way? Remember that I dont know and dont want to know the column datatypes (if they are not identical there should be error). Or is there better way to copy data between oracle and postgre
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2009
Added on Mar 2 2009
7 comments
361 views