2 Replies Latest reply on Oct 23, 2001 10:57 PM by David Jencks

    Many projects in one server

    Ekkehard Kraemer Newbie

      Hello,

      I have an application, where for each user that is currently logged on, the system should work on one of a small number of DBs (like 10 different DBs, since there are 10 different "projects" going on in the company). [It's not actually 10 different DBs, but 10 different user schemas with synonyms and views etc. - legacy system :-/ ].

      One uncomplicated solution would be to just start 10 different instances of JBoss (each with an instance of Tomcat), each of which has almost the same configuration, but just differs in the datasource configuration in jboss.jcml. Users could be "dispatched" to the correct server at login time.

      Somehow, this sounds like becoming an unmanageable beast after a short time. :-)

      On the other hand, if everything should run in one server, there is the problem of how to access the different databases. I can't simply create 10 datasources (I can, but it does not help, I think), since each deployed EJB would have to access not only one of them, but all 10. -- Am I wrong there?

      The last solution I can imagine would be a hybrid - one server, but every EJB deployed 10 times, with a different datasource configured in its jboss.xml, and a different JNDI name. This also sounds like a very ugly solution.

      Did I miss anything? Is there a good solution for this problem? Or should I just play it safe and go for the multiple-instance-of-jboss approach?

      Thanks for any replies,
      Ekkehard

        • 1. Re: Many projects in one server
          Ekkehard Kraemer Newbie

          Sigh, should have gone into the persistence forum, sorry about that. :-(

          • 2. Re: Many projects in one server
            David Jencks Master

            I'm not sure this would work... and I guess the persistence forum would be better... but how about this

            all of the 10 schemas are identical, right? and accessed by logging into the same db server under a different name.... am I correct or can you set it up this way? Can you create views (or add a column) that identifies which schema any particular row came from? (so the "pk" can identify which row in which table).


            Now... if you use the jca framework, you can write a PrincipalMapping class that maps the application login identity of the user to the appropriate Subject (username/password) for the schema they should be looking at. Pool your connections by Subject, and you should be able to do CMP, with each user only seeing stuff from their own schema.

            I haven't tried it but it seems like it might work.