title: ArrayIndexOutOfBoundsException while iterating sql resultSet with prepared statement
body: <p>I am getting the below error while fetching the result set. I am using the jdbc thin driver(<strong>ojdbc6</strong>). The interesting part is, it is giving the error after processing the <strong>10 rows</strong>. I checked in some forums and found that there is some problem with  jdbc driver. I was wondering if I can do something with this driver(ojdbc6) itself!!</p>
  
  <p>Would appreciate any help on this. </p>
  
  <p>Here is the table structure: </p>
  
  <pre><code>CREATE TABLE "TEST_SO_MANY_COLUMNS" 
     (    "COL1" VARCHAR2(4000 BYTE), 
      "COL2" VARCHAR2(4000), 
      "COL3" VARCHAR2(4000), 
      "COL4" VARCHAR2(4000), 
      "COL5" VARCHAR2(4000), 
      "COL6" VARCHAR2(4000), 
      "COL7" VARCHAR2(4000), 
      "COL8" VARCHAR2(4000), 
      "COL9" VARCHAR2(4000), 
      "COL10" VARCHAR2(4000), 
      "COL11" VARCHAR2(4000), 
      "COL12" VARCHAR2(4000), 
      "COL13" VARCHAR2(4000), 
      "COL14" VARCHAR2(4000), 
      "COL15" VARCHAR2(4000), 
      "COL16" VARCHAR2(4000), 
      "COL17" VARCHAR2(4000), 
      "COL18" VARCHAR2(4000), 
      "COL19" VARCHAR2(4000), 
      "COL20" VARCHAR2(4000), 
      "COL21" VARCHAR2(4000), 
      "COL22" VARCHAR2(4000), 
      "COL23" VARCHAR2(4000), 
      "COL24" VARCHAR2(4000), 
      "COL25" VARCHAR2(4000), 
      "COL26" VARCHAR2(4000), 
      "COL27" VARCHAR2(4000), 
      "COL28" VARCHAR2(4000), 
      "COL29" VARCHAR2(4000), 
      "COL30" VARCHAR2(4000), 
      "COL31" VARCHAR2(4000), 
      "COL32" VARCHAR2(4000), 
      "COL33" VARCHAR2(4000), 
      "COL34" VARCHAR2(4000), 
      "COL35" VARCHAR2(4000), 
      "COL36" VARCHAR2(4000), 
      "COL37" VARCHAR2(4000), 
      "COL38" VARCHAR2(4000), 
      "COL39" VARCHAR2(4000), 
      "COL40" VARCHAR2(4000), 
      "COL41" VARCHAR2(4000), 
      "COL42" VARCHAR2(4000), 
      "COL43" VARCHAR2(4000), 
      "COL44" VARCHAR2(4000), 
      "COL45" VARCHAR2(4000), 
      "COL46" VARCHAR2(4000), 
      "COL47" VARCHAR2(4000), 
      "COL48" VARCHAR2(4000), 
      "COL49" VARCHAR2(4000), 
      "COL50" VARCHAR2(4000), 
      "COL51" VARCHAR2(4000), 
      "COL52" VARCHAR2(4000), 
      "COL53" VARCHAR2(4000), 
      "COL54" VARCHAR2(4000), 
      "COL55" VARCHAR2(4000), 
      "COL56" VARCHAR2(4000), 
      "COL57" VARCHAR2(4000), 
      "COL58" VARCHAR2(4000), 
      "COL59" VARCHAR2(4000), 
      "COL60" VARCHAR2(4000), 
      "COL61" VARCHAR2(4000), 
      "COL62" VARCHAR2(4000), 
      "COL63" VARCHAR2(4000), 
      "COL64" VARCHAR2(4000), 
      "COL65" VARCHAR2(4000), 
      "COL66" VARCHAR2(4000), 
      "COL67" VARCHAR2(4000), 
      "COL68" VARCHAR2(4000), 
      "COL69" VARCHAR2(4000), 
      "COL70" VARCHAR2(4000), 
      "COL71" VARCHAR2(4000), 
      "COL72" VARCHAR2(4000), 
      "COL73" VARCHAR2(4000), 
      "COL74" VARCHAR2(4000), 
      "COL75" VARCHAR2(4000), 
      "COL76" VARCHAR2(4000), 
      "COL77" VARCHAR2(4000), 
      "COL78" VARCHAR2(4000), 
      "COL79" VARCHAR2(4000), 
      "COL80" VARCHAR2(4000), 
      "COL81" VARCHAR2(4000), 
      "COL82" VARCHAR2(4000), 
      "COL83" VARCHAR2(4000), 
      "COL84" VARCHAR2(4000), 
      "COL85" VARCHAR2(4000), 
      "COL86" VARCHAR2(4000), 
      "COL87" VARCHAR2(4000), 
      "COL88" VARCHAR2(4000), 
      "COL89" VARCHAR2(4000), 
      "COL90" VARCHAR2(4000), 
      "COL91" VARCHAR2(4000), 
      "COL92" VARCHAR2(4000), 
      "COL93" VARCHAR2(4000), 
      "COL94" VARCHAR2(4000), 
      "COL95" VARCHAR2(4000), 
      "COL96" VARCHAR2(4000), 
      "COL97" VARCHAR2(4000), 
      "COL98" VARCHAR2(4000), 
      "COL99" VARCHAR2(4000), 
      "COL100" VARCHAR2(4000), 
      "COL101" VARCHAR2(4000), 
      "COL102" VARCHAR2(4000), 
      "COL103" VARCHAR2(4000), 
      "COL104" VARCHAR2(4000), 
      "COL105" VARCHAR2(4000), 
      "COL106" VARCHAR2(4000), 
      "COL107" VARCHAR2(4000), 
      "COL108" VARCHAR2(4000), 
      "COL109" VARCHAR2(4000), 
      "COL110" VARCHAR2(4000), 
      "COL111" VARCHAR2(4000), 
      "COL112" VARCHAR2(4000), 
      "COL113" VARCHAR2(4000), 
      "COL114" VARCHAR2(4000), 
      "COL115" VARCHAR2(4000), 
      "COL116" VARCHAR2(4000), 
      "COL117" VARCHAR2(4000), 
      "COL118" VARCHAR2(4000), 
      "COL119" VARCHAR2(4000), 
      "COL120" VARCHAR2(4000)
     );
  </code></pre>
  
  <p>Table has around 200 rows and all columns are having values up to 4000 chars.</p>
  
  <p>Query Format:</p>
  
  <pre><code>select "COL1","COL2","COL3" ......."COL120" from SRC."TEST_SO_MANY_COLUMNS"
  </code></pre>
  
  <p>Code snippet: </p>
  
  <pre><code> Statement sel_stmt = connection.createStatement();
   ResultSet res = sel_stmt.executeQuery(query);
   res.setFetchSize(10000);
   ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
  </code></pre>
  
  <p>Not getting any error while fetching the resultSet. The problem occurs while iterating over the result set:</p>
  
  <pre><code>int count = 0;
  if (resultSet.next()) {
      count++ ;
      //Do Something i.e. resultSet.getObject() .. and so on.. 
  }
  // Do something 
  </code></pre>
  
  <p>The above iteration works fine for first 10 rows but gives the below exception after that. Stack trace  of the error: </p>
  
  <pre><code>java.lang.ArrayIndexOutOfBoundsException
      at java.lang.System.arraycopy(Native Method)
      at oracle.jdbc.driver.T4CVarcharAccessor.saveDataFromOldDefineBuffers(T4CVarcharAccessor.java:411)
      at oracle.jdbc.driver.T4CStatement.saveDefineBuffersIfRequired(T4CStatement.java:533)
      at oracle.jdbc.driver.OracleStatement.prepareAccessors(OracleStatement.java:1070)
      at oracle.jdbc.driver.OracleStatement.check_row_prefetch_changed(OracleStatement.java:3080)
      at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:321)
      at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:277)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>