Results 1 to 2 of 2

Thread: Can't set thread-bound database credentials in tcServer

  1. #1
    Join Date
    Dec 2005
    Posts
    21

    Unhappy Can't set thread-bound database credentials in tcServer

    In Websphere I was able to wire an interceptor around all of my controllers and set thread-bound DB credentials based on the path of the current request. In my tcServer Developer edition (2.3.3 M1) this no longer works. My datasource is wired as a

    org.springframework.jdbc.datasource.UserCredential sDataSourceAdapter

    I've verified that I'm calling the getConnection(String username, String password) method with the correct credentials. However, the connection that is returned is of type

    ProxyConnection[PooledConnection[oracle.jdbc.driver.T4CConnection@6ab4a7]]

    with the same default credentials as those defined in server.xml. Is there another way to set the database credentials at runtime?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,630

    Default

    This is an issue with the new jdbc-pool implementation, it internally always uses the default configured username/password. I suggest raising a bug on the tomcat(jdbc-pool) issue tracker.

    The actual code.
    Code:
    public class DataSourceProxy implements PoolConfiguration {
    
    ...
       /**
         * {@link javax.sql.DataSource#getConnection()}
         */
        public Connection getConnection(String username, String password) throws SQLException {
            return getConnection();
        }
    ....
    
    }
    Last edited by Marten Deinum; Sep 29th, 2010 at 02:06 AM.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •