commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave, Tushar" <tushar.d...@employease.com>
Subject RE: [DBCP] Connection gets blocked on 9th connection.
Date Tue, 07 Aug 2007 21:31:53 GMT
I use following settings.
DRIVER : com.informix.jdbc.IfxDriver
URL:
jdbc:Informix:sqli://host_ip:1557/db:INFORMIXSERVER=dbserver;user=userna
me;password=password;lobcache=-1;fet_buf_size=32767;optofc=1;ifx_autofre
e=true;
MaxPoolSize = 30
MaxIdle =20
MinIdle = 20
MaxWait = 1000
Test on Borrow = true;
When Exhuasted Action = 2 ( WHEN_EXHAUSTED_GROW )
Validation SQL = select 1 from test_table


By looking more through the debug the call to
BasicDataSource.getConnection()  calls createDataSource() which creates
a new GenericObjectPool and PoolableDataSource. The default MaxPoolSIze
for GenericObjectPool is 8 hence it fails to get the 9th connection.

Seems I am not initializing the pool properly?
Can someone give me some pointers on how I can use BasicDataSource with
GenericObjectPool.

Thanks
Tushar Dave






-----Original Message-----
From: Sergey Vladimirov [mailto:vlsergey@gmail.com] 
Sent: Tuesday, August 07, 2007 4:44 PM
To: Jakarta Commons Developers List
Subject: Re: [DBCP] Connection gets blocked on 9th connection.

Dave,

What Driver / database / settings are you using?

It seems there is underlying connection pol which prevents you from
obtaining 9th connection.

Sergey.


2007/8/7, Dave, Tushar <tushar.dave@employease.com>:
>
> I am initializing the Pool as below.
>
> private void initialize(ConnectionPoolParameters oParams)
> {
>    GenericObjectPool oPool = new GenericObjectPool(null);
>    oPool.setMaxActive(oParams.getMaxSize());
>    oPool.setMaxIdle (oParams.getMinSize ());
>    oPool.setMinIdle(oParams.getMinSize());
>    oPool.setMaxWait(oParams.getTimeout());
>    oPool.setTestOnBorrow(true);
>
>    setWhenExhaustedAction(oParams.getExhaustAction());
>
>    BasicDataSource oDataSource = new BasicDataSource();
>    oDataSource.setDriverClassName(oParams.getDriver());
>    oDataSource.setUrl(oParams.getJdbcUrl());
>    oDataSource.setValidationQuery(oParams.getConnectionTest());
>
>    ConnectionFactory oFactory = new
> DataSourceConnectionFactory(oDataSource);
>
>    PoolableConnectionFactory oPoolFactory =
>      new PoolableConnectionFactory(oFactory, this, null,
> oParams.getConnectionTest (), false, true);
>
>    _oDataSource = new PoolingDataSource(this);
>    _bEnabled = true;
> }
> It seems that BasicDataSource creates its own Pool and
> PoolableConnectionFactory and it has the default settings of the Pool
> (maxSize=8).
> So If I specified 30 as the max connections it still thinks 8 as the
max
> connections.
>
> Am I initializing the pool properly?
>
> --Tushar
>
>
>
>
>
> ________________________________
>
> From: Dave, Tushar
> Sent: Tuesday, August 07, 2007 10:43 AM
> To: 'commons-dev@jakarta.apache.org'
> Subject: [DBCP] Connection gets blocked on 9th connection.
>
>
>
> I am initializing the GeneriConnectionPool using the following
> parameters
>
>
>
> MaxActive=30
>
> MaxIdle=20
>
> MinIdle=20
>
> MaxWait=1000
>
> TestOnBorrow=true
>
> ActionWhenExhasuted =2(GROW)
>
>
>
> I try to test the connection pool by using the following code.
>
>
>
> List<Connection> liCon = new ArrayList<Connection>();
>
>
>
> for(i=0 ; i < 10 ; i++) {
>
>      Connection oCon = oPool.getConnection();
>
>      liCon.add(oCon);
>
> }
>
>
>
> The call to oPool.getConnection() gets blocked indefinitely when I try
> to get the 9th connection.
>
>
>
> Am I missing something?
>
> Any ideas
>
>
>
> Thanks
>
> Tushar Dave
>
>
>
>
>
>
>
>


-- 
Sergey Vladimirov

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message