Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Connection handling with jdbc.oracle.thin

Re: Connection handling with jdbc.oracle.thin

From: Steve Hall <shall_at_punchnetworks.NO_DARN_SPAM.com>
Date: Wed, 24 Nov 1999 15:34:03 GMT
Message-ID: <383c02ac.775760714@news.seanet.com>


Joerg wrote:
<snip>
>, the servlet hangs when doing a request.
>There is no exception thrown and no error log. After some debugging
>it seems that <statement>.executeQuery() never returns and that this
>is not a query or RDBMS problem but a timeout on the network connection
>to the oracle server. I read lots of documentation but I did not
>find anything about such a timeout. Neither <Connection>.setLoginTimeout()
>nor <Statement>.setQueryTimeout() show any effect on this behaviour.
>
>Did anyone ever experience this problem and does anyone have a
>solution for that? One could say 'create the connection in doGet()
>and close it there', but I don't want to do this if there's any
>possibility to avoid it.
>
>Thanks in advance,
>Joerg

Hello,

I've seen something similar in a connection pool we've implemented. We have two failure modes that are occurring, neither of which throw exceptions, but instead hang the connection:

  1. When attempting to get a Connection from the DriverManager and the connect string is incorrect, the user or password is bad or the database or listener is down, the connect request simply hangs indefinitely. Same thing happens on calls to Connection.close().
  2. Sometimes, after a period of connection reuse from our connection pool, a connection will simply hang up, causing us to have to kill the JVM and restart it.

I discovered something VERY interesting while developing a connection handler to time out these operations by isolating them to a separate thread: I developed this new handler class in IBM Visual Age V 2.0 ( JDK 1.1.7 ).
What I found was that when running under the Visual Age VM, the failed getConnection() calls threw exceptions every time, just like I'd expect. Bad connect string, database not available, incorrect user, etc., all worked properly and threw exceptions under VA 2.0's environment.

But on Solaris 2.6 and Windows NT using any of JDK 1.1.6, 1.1.7, 1.1.8, 1.2.1, any of the above conditions cause the calling thread to block indefinitely. We're using Oracle thin drivers connecting to an Oracle 8.0.5 database.

I suspect this is a Java VM / JDBC interaction, but I'm not sure what to do about it, other than write an elaborate connection-management system that will time out hung operations and kill the requesting thread !

Steve H Received on Wed Nov 24 1999 - 09:34:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US