title: iBatis Batch Insert fails with socket write errors
body: <p>I am faced with a rather frustrating issue for the past couple of days. I am trying to improve performance by batching inserts using iBatis. However I see that the batch insert fails with one of the following errors
  - java.sql.BatchUpdateException: IO Error: Software caused connection abort: socket write error
  - java.sql.BatchUpdateException: ORA-12161: TNS:internal error: partial data received
  - java.sql.BatchUpdateException: IO Error: Software caused connection abort: recv failed</p>
  
  <p>The details of the setup is as follows
  - Application server is Jboss 5.0.1
  - iBatis 2.3.4.732.1
  - Spring 2.5.6</p>
  
  <p>The batch insert code that I have is as follows</p>
  
  <pre><code>    try
      {
          final String finalStatement = statementName;
          int size = parameterList.size();
          int batchSize = 100;
  
          for(int ii=0; ii &lt; size;)
          {
              int toIndex = ((ii + batchSize) &gt; size ? size : (ii+batchSize));
  
              final List&lt;Object&gt; subList = parameterList.subList(ii, toIndex);
              ii += batchSize;
              count = getSqlMapClientTemplate().execute(new SqlMapClientCallback() 
              {
                  public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException 
                  {
                      executor.startBatch();
                      for(Object finalParameterObject : subList)
                      {                   
                          executor.insert(finalStatement, finalParameterObject);
                      }
                      Integer retCount = new Integer(executor.executeBatch());
                      return retCount;
                  }
              });                       
          }
  </code></pre>
  
  <p>This works occasionally and at other times fails with one of the above errors.
  We are using a connection pool and I have ensured that the blocking-timeout-millis is sufficiently high although I do not believe that this value is causing a problem here.
  I have disabled the firewall, and still see the same issue.
  It appears to me that the connection is being terminated by the database, I went thru the alert log (we are using oracle) but do not see any error on that log file. Looks like this is a configuration issue but I am not sure what needs to be changed as I have tried everything that I could think of.
  Is there any thing that I am missing?</p>
  
  <p>EDIT - If I make the batch size to be 10 in the above code (batchSize=10) then the batch insert works fine.</p>