title: java.sql.SQLRecoverableException: No more data to read from socket
body: <p>I have a database table in oracle which has a column of type DATE. It looks like the table below </p>
  
  <p>TABLE1</p>
  
  <pre><code>ID   PRODUCT_NAME  ITEM_CNT  ENTERED_DATE 
  1         prod1      500       2012-07-01
  2         prod2      1000      2012-06-30 
  </code></pre>
  
  <p>in my java code, I want to get the total item_cnt for a certain date range. here is the code sample</p>
  
  <pre><code>String sql = "select sum(item_cnt) from table1 where entered_date between ? and ?";
  Connection conn = null;
  PreparedStatement pstmt = null;
  ResultSet rset = null;
  
  try{
     conn = getConnection(url, user, passwd);
     pstmt = conn.prepareStatement(sql);
     pstmt.setDate(1, java.sql.Date.valueOf(from_date)); //from_date is a string of "yyyy-mm-dd"
     pstmt.setDate(2, java.sql.Date.valueOf(to_date)); //to_date is a string of "yyyy-mm-dd"
     rset = pstmt.executeQuery();
  
     ....
  }catch(SQLException e){
     //do something
  } finally{
     //clean up
  }
  </code></pre>
  
  <p>This code was running fine for a while until three days ago, I start getting the following exception at line pstmt.executeQuery();</p>
  
  <pre><code>    java.sql.SQLRecoverableException: No more data to read from socket
  at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1157)
  at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:290)
  at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
  at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
  at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
  at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884)
  at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)
  at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289)
  at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
  at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
  at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)
  </code></pre>
  
  <p>I tried to search for answers but couldn't find anything that really explains it. then I changed my sql query to </p>
  
  <pre><code>    "select sum(item_cnt) from table1 where entered_date between to_date(?, 'yyyy-mm-dd')  and to_date(?, 'yyyy-mm-dd')";
  </code></pre>
  
  <p>and instead of setting date, I changed the prepared statement to the following</p>
  
  <pre><code>     pstmt.setString(1, from_date);
       pstmt.setString(2, to_date);
  </code></pre>
  
  <p>Then the exception is gone. </p>
  
  <p>Another confusion is, when I populate my table, I am still using the following </p>
  
  <pre><code>   pstmt.setDate(1, java.sql.Date.valueOf(date)); //date is a string of format "yyyy-mm-dd"
  </code></pre>
  
  <p>and it is still working. only the select statement was giving me exceptions. </p>
  
  <p>Now everything is working but I really want to know why. Anyone knows?</p>
  
  <p>I did upgrade my java to 1.7.0_03-b05 recently. and I am using ojdbc6.jar. The oracle is 11g. Could this be the driver's problem? is ojdbc7 out?</p>