tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Severity less - DBCP not closing connection.
Date Fri, 21 Nov 2003 13:42:46 GMT
>     I have seen DBCP not closing a connection if the request is forwarded to
> same page in the try block before the request is forwarded. With
> sendRedirect no problem.

If you execute a "forward", then it acts just like a method call -- your 
connection will still be absent from the pool. When you forward, you 
exit your try/catch block before the browser makes the next request.

You have to do your code like this:

	conn = ...;
catch (...)


Otherwise you might deadlock your application.

> I work with one connection to test for connection leak and any bottlenecks
> in code.

This is a very good idea.

 > It works fine if I put the forward() after the end of finally
> block. I want to know whether it is bug or config error or Tomcat behaves
> so.

This is a logic error - not a Tomcat bug or config error. You just have 
to write more careful code.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message