commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Dyulgerov <newadmi...@gmail.com>
Subject Re: DBCP problem with idle object
Date Wed, 03 Dec 2008 07:32:50 GMT
Phil Steitz wrote:
> Looks like you may not be closing your connections on all control 
> paths.  Are you sure there are not exception conditions that could 
> cause your close() activations to be missed?
Hello again. I am sure that in every JSP or servlet I am closing thje 
connections with the following piece of code:

            try
            {
                pConn.close(); // my connections, gained from the 
PoolingDataSource, they are of type Connection
            }
            catch(Exception exc)
            {
                System.out.println("Exception: "+exc.getMessage());
                out.println("Exception: "+exc.getMessage());
            }
MySQL shows opened only one connection when the pool seems to be 
working. I dont know what is causing the pool to stop working and giving 
the exception. As a result of my further research on the problem on the 
Internet yesterday, I am now using the following settings for the pool:

GenericObjectPool.Config config=new GenericObjectPool.Config();
config.maxActive=50;
config.maxWait=-1;
config.testOnBorrow=true;
config.defaultAutoCommit=true;
config.minIdle=0;
config.testWhileIdle=false;

I am going to continue my work on the project, so if the exception shows 
again I'll know in a matter of hours. Thanks for your replies.

Martin


Mime
View raw message