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 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 and Relational Databases
Bookmark "Insert multiple rows in database" Watch "Insert multiple rows in database" New topic

Insert multiple rows in database

Ishita Saha
Ranch Hand

Joined: May 30, 2007
Posts: 39

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
I agree. Here's the link:
subject: Insert multiple rows in database
It's not a secret anymore!