Hi,

I have a question regarding the java.sql.sqlexception: lock wait
timeout exceeded; try restarting transaction
with respect to following code

stmtBuff(mailPieceInsert);

try{
                         for (int i = 0; i < mailCount; i++) {
                                if (count > 0) {
                                        stmtBuff.append(",");
                                }
                                stmtBuff.append("(" + sortDecionId + ",");
                                stmtBuff.append(mailRunId + ",");
                                stmtBuff.append("" + 1 + ",");
                                stmtBuff.append("" + binNumber + ",");
                                stmtBuff.append("'" + zip + "',");
                                stmtBuff.append("" + postageWeight + ",");
                                stmtBuff.append("" + autoMachId + ")");
                                count++;
                             if (count == 5000) {
                               stmt.execute(stmtBuff.toString());
                                 count = 0;
                                 stmtBuff = new StringBuffer(mailPeiceInsert);
                              }
                           }
                        if (count > 0) {
                              stmt.execute(stmtBuff.toString());
                            }
 } catch (SQLException e) {//Repeat inserting in to mailpiece
      if(e.getMessage().equalsIgnoreCase("Lock wait timeout exceeded"))
{
        stmt.execute(stmtBuff.toString());
        }else
                throw new SQLException(e.toString());
  }


I would like to catch the Lock wait timeout exceeded SQLException  and
try executing the insert statement one more time,before throwing the
SQLException (if it failed for the 2nd time).I was wondering if it is
allowed to catch
the  Lock wait timeout exceeded SQLException ,as i was unable to get
to this point in my machine.
Any suggestions or other approaches to achieve the result is highly
appreciated.
Thanks for the help,
Silpa.

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to