tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: Connection Pooling questions
Date Wed, 01 Apr 2009 02:57:01 GMT
> From:
> []
> Subject: Connection Pooling questions
> I configure it using the suggested /META-INF/context.xml with:
> maxActive="30" maxIdle="10"

Post your entire context.xml so we can see the rest of the <Resource> element.  Your
settings may conflict with what the database expects, resulting in orphaned connections.

> I assumed that maxActive would limit the total amount of DB
> connections that could ever be open at one time (in this case 30).

That limits the number the pool is managing.  If the pool considers some of them to be abandoned
or in error, the number the DB knows about may be higher.

> Yet from what I see it seems like I am limited to maxActive + maxIdle
> connections open (in this case 40).  Is that true?

Don't think so.

> Also, the default behavior seems to be that the connections 
> never close within the pool when they are not being used.

That is the whole point of having a pool.

> I do close the connections within my program using conn.close();

The evidence suggests otherwise.  You also need to close result sets and statements associated
with the connection, and all of the close() calls should be in a finally block to insure they
always get executed.

> I thought that when the connections were not used that they 
> would over time be "really" closed and I would end up with 
> the maxIdle value of 10 open connections within my Pool.

That usually depends entirely on how your DB is configured; if it has a high timeout value
(most do), the connections will persist for a long time.  You can configure a timeout value
for the pool to evict idle connections, but that's disabled by default.

 - Chuck

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:
For additional commands, e-mail:

View raw message