1 Reply Latest reply on Jan 26, 2009 3:43 AM by Vicky Kak

    Updating Datasource Credentials during runtime without flush

    Nathan Good Newbie

      Hello,

      Hopefully someone can give me some insight to my problem.
      Objective: To be able to change database user passwords without application down-time. In order to do this we have two database accounts, call them A and B.

      Steps to Implement Objective:
      Set UserName on ManagedConnectionFactory to B using setManagedConnectionFactoryAttribute() Update database password for user A Set UserName back to A, update password for user A Update database password for user B Turn off deployment scanning and update the ds-xml as well.
      Problems:
      The username and password should really be updated in an atomic transactionThe connection pool is flushed every time an attribute is set. So if a new connection is requested after the username is updated back to A, but before the password is changed, the connection attempt will fail.There is no reason for the connection pool to be flushed in this scenario, and we want to avoid it
      Questions:
      Is there any other way to update the credentials for a DataSource that will alleviate the problem of failed connections. If not can anyone give feedback on my proposed work-around of creating a new MBean method that accepts a UserName and Password but does not send a notification to any listeners, thus canceling the connection pool flush