Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes How to update a row using batchUpdate? 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 "How to update a row using batchUpdate?" Watch "How to update a row using batchUpdate?" New topic

How to update a row using batchUpdate?

Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1850

HI All,

I am facing a problem when updating a set of rows using batch updates.

Please see the code:
pStmt = con.prepareStatement(MeetPointSQLConstants.MPE_UPDATE_CONTACT_INFO);
System.out.println("Inside Update3");
pStmt.setString(1, mpeView.getOecContactInfo1().getContactName());
pStmt.setString(2, mpeView.getOecContactInfo1().getTelArea());
pStmt.setString(3, mpeView.getOecContactInfo1().getTelExch());
pStmt.setString(4, mpeView.getOecContactInfo1().getTelNum());
pStmt.setLong(5, asrId);
pStmt.setString(6, mpeView.getOecContactInfo1().getContactTyp());
System.out.println("Inside Update4");
pStmt.setString(1, mpeView.getOecContactInfo2().getContactName());
pStmt.setString(2, mpeView.getOecContactInfo2().getTelArea());
pStmt.setString(3, mpeView.getOecContactInfo2().getTelExch());
pStmt.setString(4, mpeView.getOecContactInfo2().getTelNum());
pStmt.setLong(5, asrId);
pStmt.setString(6, mpeView.getOecContactInfo2().getContactTyp());

Thanx in advance.

[Bear edit: removed "urgent" from the subject]
[ July 28, 2005: Message edited by: Bear Bibeault ]

Krishna Srinivasan
OCAJP 7/8 Exam, 400+ OCPJP Mock Questions
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1850

When i execute this code, browser is not responding it stops when stmt.executeUpdate() is called.
vu lee
Ranch Hand

Joined: Apr 19, 2005
Posts: 195
The down size of executeBatch() is that if one of the records being locked by other process, it could take a while to either response or timeout.
I agree. Here's the link:
subject: How to update a row using batchUpdate?
jQuery in Action, 3rd edition