commons-user mailing list archives

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

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:

http://jakarta.apache.org/commons/dbcp/configuration.html

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
PoolingDataSource(connectionPool);

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! :)

Thanks,

James


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


Mime
View raw message