commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Blashill" <>
Subject [DBCP] configuration confusion..
Date Fri, 23 Jul 2004 21:13:32 GMT

I'm hoping someone can clarify some things about configuring DBCP for
me. I've been reading through the documentation on the web page and I
seem to be missing something. :(

I am trying to make use of configuration properties specified here:

However, I am not sure exactly how to do that. Here is my code for
creating a DataSource.

        ObjectPool connectionPool = new GenericObjectPool(null);
        ConnectionFactory connectionFactory = new
DriverManagerConnectionFactory(MessageFormat.format(connectUri, args),
user, password);
        PoolableConnectionFactory poolableConnectionFactory = new
PoolableConnectionFactory(connectionFactory, connectionPool, null, null,
false, true);
        PoolingDataSource dataSource = new

Looking through javadocs, I realized that most of the configuration
options above can be specified in the constructors for either
GenericObjectPool or PoolableConnectionFactory. However, I still have a
few problems:

1) How is prepared statement pooling enabled/disabled? The above link
describes a poolPreparedStatements property that I have figure out where
to specify. It seems to me that if you pass a KeyedObjectPool as the
third parameter of PoolableConnectionFactory's constructor you will
enable prepared statement pooling. Is this correct?

2) How do I specify the loginTimeout value? PoolingDataSource gives me
an UnsupportedOperationException when I try to invoke it's
setLoginTimeout() method.

3) Just out of curiosity, what goes into the Properties parameter for
the constructor of DriverManagerConnectionFactory? Parameters you want
to use to initialize your driver?

Sorry for the long email, but I appreciate any words of wisdom out
there! :)



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

View raw message