3 Replies Latest reply on Jun 26, 2002 9:52 PM by jholliday

    Switching dynamically between several datasources at login

    innovatis

      Hello
      I'm working with Jboss 3.1a. In my environment I've implemented the DatabaseLoginModule and it works perfectly with our mysql db. Now I want to create a test db and I'd like to allow users to switch between the two datasources when the login Dialog appears. (ex. Drop down with db connection).
      Does somebody know how i can configure several datasources in Jboss using only one jboss.xml and all DS the same DatabaseLoginModule defined in login-config.xml for dynamic datasource binding?

      Regards,
      Carlo

        • 1. Re: Switching dynamically between several datasources at log
          davidjencks

          I'm not clear on the level of abstraction you want here. You can have the user tell the app what ds to use, and use that string as the jndi name of a datasource. This will restrict you to session beans and bmp.

          Dan Bunker wrote a MappingIdentity login module and jca wrapper (modified slightly from the local tx wrapper) that, using the same jndi-bound datasource, connects different users to different databases. You could extend this easily to allow the user to select the database at login and attach that selection as additional security information. Let me know if you want a copy.

          • 2. Re: Switching dynamically between several datasources at log
            innovatis

            Hi David

            Thank you very much for your answer.
            I think that's exactly what I'm looking for.
            It would be very helpful, if you could send me a copy of this module (or a short sample) so that I can understand the design approach that has been used.


            Kind regards,
            Carlo

            • 3. Re: Switching dynamically between several datasources at log
              jholliday

              We are using Jboss 2.4.4 and BMP with out entity beans. We have the same problem determining the DB for our users. Could you post an example of how this could be done?