tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dowling" <mich...@e-acumen.com>
Subject RE: Which JDK to use under Linux?
Date Tue, 13 Jun 2000 18:20:26 GMT
> > But you have to ensure, that all ResultSets, Statements and
> Connections are
> > marked as free with .close() before the servlet stops.
>
> Yes, this is what I do.

Are you sure?  :-)

The reason for me asking is because we had a similar issue, and we were
"sure* that our code released our connections back to the pool.  What we
*didn't* figure, was pages with errors.  When an error occurred, we did NOT
free connections.

This seems like a *duh* thing to do, but in JSP, it can be a bit tricky to
remember all the things that may go wrong, and possibly skip your
connection.close().

What we did was wrap our DB connection pool stuff within a JSP bean, and
place the Connection.close() method within that bean's finalize() method.
This pretty much guarantee's that connection to be closed (and, it even made
our pages a little prettier ;-).

<jsp:useBean id="dbconn" class="com.eacumen.blah.blah.dbwrapBean">
	<jsp:setProperty name="dbconn" property="database" value="ourdb" />
</jsp:useBean>


Connection c = dbconn.getCOnnection();


=)

Hope that helps.

thanks, mdd

-----------------------------------------
Michael D. Dowling <michael@e-acumen.com>
V.P., Technology
e-Acumen.com, Inc.



Mime
View raw message