8 Replies Latest reply on May 9, 2003 7:41 AM by bkbonner

    Multiple datasources over single connection pool

    trygvis

      Hi

      I would like to have several datasources getting connection from a singe connection pool.

      Today I create a single connection pool for each datasource as I havent been able to figure our this problem. Ive read both the public docs, the docs from the subscription and google.com.

      Any example configurations would be appreciated.

      Trygvis

        • 1. Re: Multiple datasources over single connection pool
          davidjencks

          The current jboss connection pools don't support this. Why would you want this? The connections aren't going to be interchangeable, so I don't really see the point in putting them in a single pool. Please explain.

          • 2. Re: Multiple datasources over single connection pool
            trygvis

            Wath I want to do is to deploy a set of .ears, each possilbly containing more that one bean. I regard all these .ears for a component and each component has its own set of tables to manage. So, I use a datasource with the same name of the component like:

            /com///DataSource

            But as im writing this, i realize that I can trick this when deploying the ejb. But im pretty shure that at least weblogic and sun one can to this.

            Trygvis..

            • 3. Re: Multiple datasources over single connection pool
              davidjencks

              If all the tables are in the same database, use the same pool for all the ejbs. You can use resource-refs to give each bean its appropriate local datasource name in the java:/comp/env space, but map these all to the same global jndi java:/realdatasourcename.

              What additional useful functionality would you get from having connections from multiple datasources in the same pool?

              • 4. Re: Multiple datasources over single connection pool
                jogura

                What if you wanted to have one JBoss server connect to multiple datasource depending on the user? Think of a data center hosting may different company/users environments.

                How would you setup the environment so that one instance of the server can host multiple users that use different databases?

                Then, if this could successfully be done, you can cluster the JBoss servers to use multiple datasources, thus improving performance, scalability, etc.

                Thoughts? Comments?

                • 5. Re: Multiple datasources over single connection pool
                  bkbonner

                  David, how do I perform the mapping of a resource-ref in my web.xml file (that I don't want to change because my code uses it) to an existing data source specified in jboss. Let's say for example that I want to map the resource:

                  <resource-ref>
                  JDBC
                  <res-ref-name>jdbc/TestSource</res-ref-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <res-auth>CONTAINER</res-auth>
                  </resource-ref>

                  to a datasource named java:DataSource?

                  In websphere (which I'm more familiar), I do this association at deployment.

                  Thanks.

                  • 6. Re: Multiple datasources over single connection pool
                    bkbonner

                    From the Jboss 3.0 docs on page 93 and 103/106. I suppose it's the jboss-web.xml that I need to bundle with web.xml in the WEB-INF directory of the war? Can someone confirm this?

                    • 7. Re: Multiple datasources over single connection pool
                      davidjencks

                      That's correct. For ejbs, you perform a similar mapping in jboss.xml

                      • 8. Re: Multiple datasources over single connection pool
                        bkbonner

                        Thank you.