aspose file tools*
The moose likes JDBC and the fly likes Insert multiple rows in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Insert multiple rows in database" Watch "Insert multiple rows in database" New topic
Author

Insert multiple rows in database

Ishita Saha
Ranch Hand

Joined: May 30, 2007
Posts: 39
Hi,

I need to code a program in Java with JDBC connection to ORACLE where I need to get say 200 rows from a table in database. Insert 50 more rows in the resultset and do some changes in the exisiting 200 rows (some column data) and then write it back to database. I

s there a way I can do this directly in the resultset and write back the result set (250 rows this time) back to database.

The other lenghty process will be to store the reslutset in a multidimensional array - do all changes in Array and then write the rows one by one. may be in a loop using prepared statement.

Can anybody please suggest a cleaner and faster approach.

Thanks in advance
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
Take a look at the examples in ResultSet documentation http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Insert multiple rows in database