• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to update a row using batchUpdate?

 
Krishna Srinivasan
Ranch Hand
Posts: 1874
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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());
pStmt.addBatch();
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());
pStmt.addBatch();
pStmt.executeBatch();

Thanx in advance.

[Bear edit: removed "urgent" from the subject]
[ July 28, 2005: Message edited by: Bear Bibeault ]
 
Krishna Srinivasan
Ranch Hand
Posts: 1874
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i execute this code, browser is not responding it stops when stmt.executeUpdate() is called.
 
vu lee
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krisna,
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic