title: JDBC timeout is not throwing SQLTimeoutException
body: <p>I am trying to set the query timeout on a JDBC Statement and expecting it to throw an SQLTimeoutException when it times out.
  But instead I am getting a generic SQLException with error code ORA-01013.</p>
  
  <p>Any idea what I must be missing?</p>
  
  <p>I am looking for a DB independent way to handle timeouts. And checking for DB specific error codes may not help there.</p>
  
  <p>BTW, I am setting this property via Spring's JdbcTemplate.</p>
  
  <pre class="lang-java prettyprint-override"><code>myStatement.setQueryTimeout(1);
  </code></pre>
  
  <p>throws</p>
  
  <pre><code>java.sql.SQLException: ORA-01013: user requested cancel of current operation
  </code></pre>
  
  <p>Edit: Here is the stack trace for the error. I am using a thin driver (ojdbc6-11.2.0.1.0.jar).</p>
  
  <pre><code>java.sql.SQLException: ORA-01013: user requested cancel of current operation
  
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
      at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
      at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:205)
      at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:861)
      at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1145)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1259)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
      at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3493)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
      at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:703)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:722)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:772)
      at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:211)
      at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:219)
      at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:233)
      at mytest.MyDAO.retrieve(MyDAO.java:12)
  </code></pre>