You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Eugene Droi <ed...@cbnco.com> on 2003/05/14 16:34:23 UTC

DataSource.getConnection(userName, password)

Hi guys,

Is there any particular reason why DataSource.getConnection(userName, 
password)
is not implemented. I don't like the idea of specifying username and 
password as open
text in my server.xml for security reasons, besides it limits my 
application to only one username and password
combination.
Currently I made a weird workaround like :
-----------------------------------------------------------------------------------------
            DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
            ((BasicDataSource)ds).setUsername(userName);
            ((BasicDataSource)ds).setPassword(password);
            ((BasicDataSource)ds).setUrl(dbURL);
            connection = ds.getConnection();
-----------------------------------------------------------------------------------------
Connection pooling seems to work in such case, but I just wonder what I 
am missing here
and what prevented the DBCP developers to implement 
getConnection(userName, password) ?

Appreciate any help
Eugene