failed batch operations can lead to jdbc driver sequence errors
---------------------------------------------------------------

                 Key: IBATIS-563
                 URL: https://issues.apache.org/jira/browse/IBATIS-563
             Project: iBatis for Java
          Issue Type: Bug
          Components: SQL Maps
    Affects Versions: 2.3.4
         Environment: Hp NonStop H06.14 , NonStop Java 1.5.0_02  Ibatis build 
2.3.4.726

            Reporter: Alan Charley


Upon failure of a batched SQL statement the driver will report  
"function_sequence_error" on the next attempt to use the statement. This 
because statement is being cached and is marked as being part of a batch 
operation.  Before closing the statement the batch operation should be cleared. 
 See code snippet below from SqlExecutor.java


    public void cleanupBatch(SessionScope sessionScope) {
      for (int i = 0, n = statementList.size(); i < n; i++) {
        PreparedStatement ps = (PreparedStatement) statementList.get(i);
  
      /* code added by ajc follows */
        if (ps != null) {
           try {        
            ps.clearBatch();    
           } catch (SQLException e) {
               // ignore
           }
        }
        /* end of code by ajc */
 
        closeStatement(sessionScope, ps);
      }
      currentSql = null;
      statementList.clear();
      batchResultList.clear();
      size = 0;
    }
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to