commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: [DBCP 1.1] DataSource.getConnection(usr, pwd): Cannot create Pool ableConnectionFactory
Date Wed, 03 Dec 2003 18:28:58 GMT
BasicDataSource delegates the getConnection method calls to a 
PoolingDataSource and therefor doesn't support the getConnection(String 
username, String password) method call.

If you really want to use this method then you can use PerUserPoolDataSource 
or SharedPoolDataSource.

If the unencrypted password in server.xml is the main problem then you can 
also subclass BasicDataSourceFactory and add some code to fix your issue.

You can then encrypt the password or load the password from another source.
The tomcat start script could ask for a password, store it in a temp file, the 
factory would read the file (and after tomcat is started the script would 
delete the password file).

If you choose this last option then I'm interested in your solution (to put on 
the site as an example).

-- Dirk wrote:

> The method BasicDataSource.getConnection(String username, String password)
> is now implemented, but using it (from Tomcat 4.1.29, DBCP 1.1, Pools 1.1)
> raises an SQLException. The JDBC driver complains about not having got the
> user credentials. Seems like username and password aren't passed internally
> (or have I done anything wrong?). 
> BTW: putting the credentials into Tomcat's server.xml and using
> getConnection() works, but using getConnection(with params) throws an
> UnsupportedException in PoolingDataSource.getConnection().
> Any workaround? I need to provide the credentials at runtime to avoid
> storing them in the server.xml (unencrypted!).
> Thanks for any help!
> Michael Bellinger

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

View raw message