I don't think it is TOTALLY offtopic, since the problem occurs within Tomcat... and 
when I close tomcat all the connections and cursors are released...
 
as I said in my email I close ALL ResultSets and Statements in "finally" blocks...
 
as for "closing" the Connection... can I use the finalize() in the DAO* classes to use 
the method that returns the Connection to the pool?? Cuz I can't see anywhere else 
where I'd be able to do that...
 
.:| Christian J. Dechery
.:| FINEP - Depto. de Sistemas
.:| [EMAIL PROTECTED]
.:| (21) 2555-0332

>>> [EMAIL PROTECTED] 21/08/02 15:32 >>>
This is totally off topic for TOMCAT-USER, but ...

The basic rules for successful use of a connection pool:

* Always close the connection before the current request completes
  (which doesn't really close the underlying Connection; it just
  returns it to the pool.

* Always close your ResultSet and Statement instances when you
  are through with them -- a "finally" clause is good for this.
  It sounds like you have missed some error cases.

* Never try to share an individual Connection across more than
  one request -- Connection instances are *not* shareable.  That's
  why you're using a connection pool in the first place.

I suspect that your code is violating one or more of these principles --
probably on some rarely executed code path (because it takes some time for
the problem to surface).

Craig


On Wed, 21 Aug 2002, Christian J. Dechery wrote:

> Date: Wed, 21 Aug 2002 15:01:04 -0300
> From: Christian J. Dechery <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] 
> Subject: problems with Connections
>
> I have this big problem handling Oracle Connecions...
>
> something goes wrong... I have tons of classes called DAO"Something"... and a class 
>called DAO which provides the Connection... the DAO*s requests the Connection from 
>DAO and uses it, but there is no method to close the connection since it is used by 
>several methods that run queries (selects and updates)...
>
> I don't know what goes wrong... but after some time of using the applicatiob the 
>maximum number of cursors exceeds and the whole application stops, cuz no more 
>queries will run... and I am closing ALL ResultSets and Statements on the "finally" 
>block of EVERY query...
>
> this happend when I dispense one Connection to several classes, thus achieving some 
>kind of sharing... if I turn that sharing off - every class will get an exclusive 
>Connection, the problem changes... now instead of the maximum number of cursors 
>exceeding, I get maximum number of processes (connections)...
>
> the connections (nor the cursors for that matter) are getting closed... I even tried 
>placing a con.close() on the finalize() method of the DAO*s... but that didn't 
>work... I get an IOException: socket closed...
>
> At the Oracle support service, I saw that a lot of people has the exact same 
>problem..
>
> does anyone knows how to solve this???
>
> thanks
>
> btw: I have a "solution" working now... I changed the code of my DAO*s, so that 
>every method that runs a query, requests a connection, than closes it... but that 
>makes some parts of the application veeeeeeeeery slow...
>
> .:| Christian J. Dechery
> .:| FINEP - Depto. de Sistemas
> .:| [EMAIL PROTECTED] 
> .:| (21) 2555-0332
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to