tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shaun Farrugia <sfarru...@fry.com>
Subject RE: Connection Pooling questions
Date Wed, 01 Apr 2009 15:00:22 GMT
Sweet,

I set up a test.jsp page that will Connection.close() without rs.close() and ps.close(). 
Will let you know the results..

And I know you answered this before but I have to ask again.

Tomcat is using it's own version of DBCP (based on properties files)  Are there any changes
to DBCP other than package moves?  Can I utilize the DBCP source package and expect that it's
the same code tomcat is using?


-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Wednesday, April 01, 2009 10:47 AM
To: Tomcat Users List
Subject: RE: Connection Pooling questions

> From: Shaun Farrugia [mailto:sfarrugia@fry.com]
> Subject: RE: Connection Pooling questions
> 
> What happens when the statement isn't closed but the 
> connection is returned to the pool?

The connection object your code sees isn't the real connection; it's a wrapper created by
the pool to control access to the real thing.  Likewise, the ResultSet, Statement, PreparedStatement,
etc., objects visible to the webapp are also wrappers around the real objects.  Using these,
the pool knows if the real connection has been cleaned up properly; the pool won't reuse the
connection until it is has returned to an idle state.

> I have some code blocks that don't have a finally block 
> to close the result set and prepared statement.  If an 
> exception happens the statement and the result set stay
> open but the connection gets returned to the pool.

A brief scan of the code in commons-dbcp indicates that when a Connection.close() is done,
an attempt is made to close the associated Statement and ResultSet objects.  Some experimentation
(which I don't have time for right now) would make me more comfortable with that observation.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message