6 Replies Latest reply on Apr 10, 2003 4:11 PM by Vyacheslav Zheltonogov

    Dynamic Database Connections

    Binoy Shah Newbie

      Hi,

      First of all i am sorry if my requirements sound a bit off-bit or way wards or unnecessary.

      I want to know whether we can create dynamic database connections using the configuration for database:

      I mean i want to store the configuration : Username, Password, Database URL of my database connection factory in a LDAP server so that i can Change the Parameters dynamically without reloading the server

      Is it possible... if yes ... can any one hint towards the probable solution

      Cheers

      Binoy

        • 1. Re: Dynamic Database Connections
          David Jencks Master

          Mostly your requirements are not sufficiently specified.

          If you want to, for example, change the db url, user. and pw for a pool once a day, and kill all the old connections and start over, you should be able to do this right now through jmx. If you store the settings in ldap please explain how you would notify the pool that the settings have changed.

          On the other hand, if you want the database connected to to depend on the identity of the user logging in, you need a special login module and modified jca-jdbc wrapper. Someone wrote one where the user/pw/dburl info is stored in a db: I considered committing it to cvs but it required quite a bit of cleanup that I haven't had time for. However, I think I can find it and send it to you if you want.

          Or perhaps you have something else in mind.

          • 2. Re: Dynamic Database Connections
            Binoy Shah Newbie

            yes it would be quite helpful if i can get that module and have a hands on to whatever it has to offer.

            Secondly i am still working on making my requirements more refined.

            Will get back soon

            Cheers

            Binoy

            • 3. Re: Dynamic Database Connections
              Binoy Shah Newbie

              >If you want to, for example, change the db url, user. >and pw for a pool once a day, and kill all the old >connections and start over, you should be able to do >this right now through jmx. If you store the settings in >ldap please explain how you would notify the pool that >the settings have changed

              Is it possible to reload the configuration settings automatically after a pre-defined period ?

              right now i guess it loads/caches the connection specifications from the db-service.xml descriptor in the deploy folder the very first time and then uses same connection till the server is reloaded or the Mbean is re-started.
              Can this be achieved :
              Scheduled reload of the connection parameters ?

              • 4. Re: Dynamic Database Connections
                David Jencks Master

                You can use the Scheduler mbean to periodically run something that reads the config parameters (from ldap?), stops the adapter mbeans, changes the config, and restarts them.

                I'm having network problems with the machine that has the adapter I mentioned, I can't get to it right now.

                • 5. Re: Dynamic Database Connections
                  Benoit Quintin Newbie

                  Could you post said code, we need to have the user/password in a separate DB, and not in the config files... ??

                  Thanks

                  • 6. Re: Dynamic Database Connections
                    Vyacheslav Zheltonogov Newbie

                    Hi,

                    That is exactly what I need - to be able to connect to the db on-the-fly on-runtime based on the user/pw/dburl. Could I also have a copy of that code you've mentioned.

                    Or if you could tell how I can programmatically build connection pools. I suppose I have to create an instance of the MBean server and register some MBean class, and then I should be able to set pool properties. I'm not sure what MBean class I need to use for that purposes.

                    Thank you in advance,
                    Slava