Connection pool with no db user/pwd on Weblogic/Websphere


EJB programming & troubleshooting: Connection pool with no db user/pwd on Weblogic/Websphere

  1. My application gets database connections from a data source using getConnection(user, password). To accomplish this, an empty connection pool must be created. This works as expected on Oracle iAS, Sun ONE and JBoss. But how do I accomplish this on Weblogic and on Websphere?

    If I create a pool without specifying username/password on Weblogic, the pool can not be created. Websphere manages to create the pool but it will throw an exception on every call to getConnection(username, password).

    I guess I'll have to configure the pools differently, but how? Or is this not supported by W*?

  2. Maybe I need some clarification here. Even you can manage to create a pool without user/password and throws Exception on getConnection call. That still means that you don't have any opened connection in advance to serve the client. This defeat the purpose of having connection pool, the idea of maintaining a number of opened connections and re-use it for each client request. This is no different than creating a new connection for each client. If you need to pass in user/password to control role access, maybe you can do this from database side. Just setup a generic account for the pool.
  3. What I want is a pool that can contain different connections (not all equal). Kind of a pool within the pool.

    Take JBoss as an example. If no user/password is configured in my data source and minSize is 5, when JBoss is started the pool is empty.

    If I get a reference to the data source and call getConnection("userA", "userApwd"), 5 such connections will be created in the pool (and one will be returned).

    If I call getConnection("userB", "userBpwd"), 5 new connections will be created in the pool (and one will be returned).

    Thus, the pool contains 10 connections using two different users.

    On JBoss there is a special attribute you have to add when you create the pool in order to get this behaviour (can't remeber what it is). Otherwise only a single "connection type" may exist in the pool.

    The problem is that I can't figure out how to do this on Websphere and on Weblogic.

  4. Turns out this is not supported by Weblogic. Works fine on Websphere, though.