Hi I have a vector of vectors now each vector element of the parent vector contains a record i want that all vector elements .i.e records shud be inserted into database at one go I mean Is it possible to insert multiple records at same time because insert statement inserts only one record at a time and statement only will insert one record at a time and on submit of form i want all records to be inserted Can anyone pls throw some light on it Thankx in advance Gaurav
SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
See java.sql.Statement.addBatch(), java.sql.Statement.executeBatch(). HTH - Peter
Joined: Jun 09, 2000
HI peter thnkx for ur reply but in my case i hvae to use same statement for inserting records in the db and unless we commit first insert we cannot insert next statement as it locks the row in which we intend to insert i hope u get wht i m trying to explain any other views r most welcome Gaurav
Originally posted by Peter den Haan: See java.sql.Statement.addBatch(), java.sql.Statement.executeBatch(). HTH - Peter
Peter den Haan
Joined: Apr 20, 2000
Originally posted by Gaurav Chikara: in my case i hvae to use same statement for inserting records in the db and unless we commit first insert we cannot insert next statement as it locks the row in which we intend to insert i hope u get wht i m trying to explain
Sorry, but I do not quite get it. All the inserts are part of the same transaction, so the locks you acquire are irrelevant. Anyway, addBatch() is AFAIK the only way to efficiently execute a batch of statements in JDBC. - Peter
We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.