Seetha,

> To answer Tim's question, we are not explicitly closing connection
> and statement objects as the context xml has these resource parameters.
> 
> removeAbandoned="true"
> removeAbandonedTimeout="60"
> logAbandoned="true"

This probably means that you are leaking every single connection. :(

> Shouldn't DBCP take care of creating new connection if the connection
> object is stale?

You will be creating new Connection objects all the time -- basically
you'll never re-use a database connection, making the pool completely
irrelevant; you may as well call DriverManager.getConnection each time
you need to make a SQL query.

Even if DBCP /does/ clean up after you, you /really/ need to call
"close" on your statement, resultset, and connection objects in finally
blocks in your code. If you don't, your code will probably not work
if/when you switch to another connection pool, another app server,
another database, etc.

Most databases allocate lots of memory for each database connection on
the server side, which means that every useless connection you have
waiting around to be cleaned up by DBCP will be taking up memory on your
database server that could be used to serve actual requests.

Whether this solves your original problem or not, you definitely need to
modify your code to close all of those objects.

-chris


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to