You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by mi...@ADBag.de on 2003/12/03 16:47:59 UTC

[DBCP 1.1] DataSource.getConnection(usr, pwd): Cannot create Pool ableConnectionFactory

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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [DBCP 1.1] DataSource.getConnection(usr, pwd): Cannot create Pool ableConnectionFactory

Posted by Dirk Verbeeck <di...@pandora.be>.
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.
http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/datasources/package-summary.html

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


michael.bellinger@ADBag.de 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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org