commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Sodomaco <and...@sodomaco.it>
Subject [dbcp] PoolingDataSource setup problem
Date Thu, 11 Aug 2011 08:36:05 GMT
  Hi,

I tried to follow this example
http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDataSourceExample.java?view=markup

but at lines 148/149
148 PoolableConnectionFactory poolableConnectionFactory =
149         new PoolableConnectionFactory(connectionFactory);

it fails because, according to 
http://commons.apache.org/dbcp/api-1.4/index.html 
<http://commons.apache.org/dbcp/api-1.4/index.html>, all constructors 
need an ObjectPool
but also all costructors of GenericObjectPool need a PoolableObjectFactory!

I "solved" the problem by this work-around
PoolableConnectionFactory poolableConnectionFactory =
                   new PoolableConnectionFactory(connectionFactory,*new 
GenericObjectPool()*,null,null,false,false);

ObjectPool connectionPool =    new 
GenericObjectPool(poolableConnectionFactory);
poolableConnectionFactory.setPool(connectionPool);


that uses a  "fake"  GenericObjectPool.
I don't think this is the right solution. What I am missing?

Thanks in advance.
Andrea


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message