You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Philip Hachey <ph...@nrc-cnrc.gc.ca> on 2016/07/08 21:16:54 UTC

Dynamically determine which credentials to use for a Tomcat JDBC Connection Pool [Tomcat 8.0.36]

Hi.  I'm looking for a way to dynamically determine which username and 
password to use for a Tomcat JDBC Connection Pool 
[https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html] based on the 
database URL to which it is connecting.  I imagine this as an external 
key=value lookup where (database URL)={username, password}.

However, I've not been able to set the user credentials programatically 
as I'd hoped via dataSource.getConnection(username, password) despite 
setting alternateUsernameAllowed="true" in the context.xml Resource 
element and leaving the username and password attributes blank.  I also 
tried setting the auth attribute to "Application" instead of 
"Container", but that didn't make any difference.  What would be the 
correct way of doing this?  I'm also open to other suggestions.

Thank you,
Philip

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org