Announcement Announcement Module
No announcement yet.
oracle.jdbc.ReadTimeout not leading to expected socket timeout Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • oracle.jdbc.ReadTimeout not leading to expected socket timeout


    We're using Spring+Hibernate in our application, and we have a strange problem. I realize this is not a Spring issue, but we're clueless and I figured it's worth posting this here just in case anyone has encountered this issue.

    I'm using the ojdbc6.jar version Using DBCP for Connection pooling, jar is Apache's commons-dbcp.jar version 1.2.2.

    I wanted to define a socket timeout for each connection created by the connection pool.
    I read in this forum that I can just set the 'oracle.jdbc.ReadTimeout' property and so I did the following steps:

    1) Created a datasource (org.apache.commons.dbcp.BasicDataSource) with connection property 'oracle.jdbc.ReadTimeout' = 600000.
    2) Unplugged my network cable.
    3) Tried to create a new connection by the datasource.

    When debugging, I could see that is called with the value I've defined(600000).
    However, it seems like my definition matters not and an org.apache.commons.dbcp.SQLNestedException with a cause of java.sql.SQLRecoverableException (with code 0RA-17002) is thrown
    after 3-5 seconds regardless of the value I defined for the 'oracle.jdbc.ReadTimeout' property.
    Of course I've tried other values (also tried putting 0), but the timeout keeps happening after 3000-5000 miliseconds.

    What am I doing wrong here? Surely this should work.

    Thanks, Uri.

  • #2
    Similar problem, another option

    Hi uribar,

    maybe this will not help you after you got no answer the last 11 months. But I had a similar problem to solve and and found your question here.

    Tests using the parameter oracle.jdbc.ReadTimeout did not solve my problem with hanging oracle connections.

    There is another Oracle connection property which seems to set a socket read timeout: (in milliseconds). After setting this as connection property, the connection was resetted after the given time throwing a normal SQLException.

    My source was



    • #3

      Wow, many thanks!
      I'll check that...