@Override public int[] executeBatch() throws SQLException {
  try {
    debugCodeCall("executeBatch");
    checkClosedForWrite();
    try {
      if (batchCommands == null) {
        batchCommands=New.arrayList();
      }
      int size=batchCommands.size();
      int[] result=new int[size];
      boolean error=false;
      SQLException next=null;
      for (int i=0; i < size; i++) {
        String sql=batchCommands.get(i);
        try {
          result[i]=executeUpdateInternal(sql);
        }
 catch (        Exception re) {
          SQLException e=logAndConvert(re);
          if (next == null) {
            next=e;
          }
 else {
            e.setNextException(next);
            next=e;
          }
          result[i]=Statement.EXECUTE_FAILED;
          error=true;
        }
      }
      batchCommands=null;
      if (error) {
        throw new JdbcBatchUpdateException(next,result);
      }
      return result;
    }
  finally {
      afterWriting();
    }
  }
 catch (  Exception e) {
    throw logAndConvert(e);
  }
}

@ Override public int [ ] executeBatch ( ) throws SQLException { try { debugCodeCall ( "executeBatch" ) ; checkClosedForWrite ( ) ; try { if ( batchCommands == null ) { batchCommands = New . arrayList ( ) ; } int size = batchCommands . size ( ) ; int [ ] result = new int [ size ] ; boolean error = false ; SQLException next = null ; for ( int i = 0 ; i < size ; i ++ ) { String sql = batchCommands . get ( i ) ; try { result [ i ] = executeUpdateInternal ( sql ) ; } catch ( Exception re ) { SQLException e = logAndConvert ( re ) ; if ( next == null ) { next = e ; } else { e . setNextException ( next ) ; next = e ; } result [ i ] = Statement . EXECUTE_FAILED ; error = true ; } } batchCommands = null ; if ( error ) { throw new JdbcBatchUpdateException ( next , result ) ; } return result ; } finally { afterWriting ( ) ; } } catch ( Exception e ) { throw logAndConvert ( e ) ; } }
executes the batch . if one of the batched statements fails , this database will continue .
