Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2004

Tip: Looking for answers? Try searching our database.

A bug in ORACLE JDBC close Connection?

Thread view: 
Sun - 30 Jan 2004 16:40 GMT
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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.