commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wes Clark" <>
Subject RE: DBCP problem with idle object
Date Mon, 01 Dec 2008 17:45:07 GMT
You say you might have up to 100 active connections, but you only
configure for 15.  Are you sure you don't just need to increase the
number of active connections?  Also, if you test of borrow, I don't
think you need to test on return or test on idle. 

-----Original Message-----
From: Martin Dyulgerov [] 
Sent: Monday, December 01, 2008 9:18 AM
Subject: DBCP problem with idle object

Hello group!

This is the first time i actuali write something in here. First of all -
please excuse my bad english, it is not my native language. Now to get
to the point... I have problems implementing DBCP on my Tomcat 6.0.18 in
my web applications. I don't want to use JNDI, that is why i have
ServletContextListener, in witch i do as follows in order:

1.Define GenericObject Pool
2. Define ConnectionFactory as implementation of
DriverManagerConnectionFactory 3.Define PoolableConnectionFactory with
the previously created GenericObjectPool and ConnectionFactory 4.Define
PoolingDataSource with the GenericObjectPool object from step 1

Then i "stick" my PoolingDataSource to the servlet context, retreive it
in my JSPs and servlets and aquire a connection via "getConnection()" 
(which returns Connection object). I make sure to close() all my
connections at the edn of the pages...I am sure that the connections
that are opened dont exceed the number 100 (which is the maximum number
of connections on my database - a MySQL database system), so i think
there must be something wrong with my pooling code. The exact error i
get is:

"Exception: Cannot get a connection, pool error Timeout waiting for idle
object SQL Exception Connection is closed. SQLException Connection is
closed." At some point i began to ask myself if it the problem is caused
by the restarts(reloads) i do for that exact application, because the
other work fine (byt i dont play with them that much)... My
configurations for the GenericObjectPool and
DriverManagerConnectionFactory are as follows:

GenericObjectPool.Config config=new GenericObjectPool.Config();

Properties p=new Properties();
            p.setProperty("user", user);
            p.setProperty("password", password);
            p.setProperty("useUnicode", "true");
            p.setProperty("characterEncoding", "CP1251");
            p.setProperty("autoReconnect", "true");

Can You help me please? Any help will be appriciated. Thanks in advance,
and accept my apologies if i have breaked some rules of the group or
something like that.

All best,


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

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

View raw message