Hi to all friends!
I have a big problem. My application is running on Tomcat 4.0.5 and
uses an ORACLE db:
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection conn=DriverManager.getConnection
("jdbc:oracle:thin:@xxx.xxx.xxx.xxx:xxxx:xxx","******","*****");
I am sure that every connection that I open is also closed
but last night, after a great work,
ORACLE didn't accept any connection because the maximum number
of connection was reached.
My application is the only that at the moment uses ORACLE.
Is it possible that there is a bug in the JDBC driver,
included in ORACLE installation, that does not really close
connections to the db?
I use the Oracle8i Enterprise Edition Release 8.1.7.4.0
Many thanks to all
Riccardo
Joe Weinstein - 30 Jan 2004 17:40 GMT
> Hi to all friends!
>
[quoted text clipped - 19 lines]
> Many thanks to all
> Riccardo
Hi. I'd be happy to look at your code. There is pooling code in the
oracle driver, which *might* retain connections for re-use instead
of closing them when the app closes them, but I do not know when
this behavior would be invoked. The usual case I see is insufficient
thread-safety in servlets and JSPs etc, in that a given servlet is
typically a single instance, executed simultaneously by multiple
threads. Unless you define the JDBC connection as a method-level
object (ensuring each thread gets it's own connection), two threads
can be running, and each see the connection as null, each create
a new connection and assign it to the same variable, and the first
one to do so gets their connection reference overwritten and lost,
and the two threads share the connection set by the second.
If you were to run your tomcat under a Java debugger, it would show
if there are any oracle connection objects collecting...
Joe Weinstein at BEA
Ronald Cole - 30 Jan 2004 20:57 GMT
> I am sure that every connection that I open is also closed
> but last night, after a great work,
[quoted text clipped - 5 lines]
> included in ORACLE installation, that does not really close
> connections to the db?
It's Orrible's way of pushing you towards using the connection pool...
;)

Signature
Forte International, P.O. Box 1412, Ridgecrest, CA 93556-1412
Ronald Cole <ronald@forte-intl.com> Phone: (760) 499-9142
President, CEO Fax: (760) 499-9152
My GPG fingerprint: C3AF 4BE9 BEA6 F1C2 B084 4A88 8851 E6C8 69E3 B00B