3 Replies Latest reply on Jan 10, 2007 11:11 PM by jali

    how to config one database for serveral datasources?

    jali

      I use jboss 4.0.1
      normally we config one datasource for one type database. so if in my system, there are serval datasources. for instance, i have mysql database and serveral datasources (A?B?C)in mysql. how can i config it in jboss.

        • 1. Re: how to config one database for serveral datasources?
          jali

          maybe i need to commend it clearly.

          in my mysql. there are three databases(A?B?C),i want to use them at the same time in my current system. how to config it in jboss.

          • 2. Re: how to config one database for serveral datasources?
            kaobe

            Hi,

            either you define n *-ds.xml files, each defining one database connection, or you use one -ds.xml file that defines the n connections to the database. Inside the datasources tag you can define n datasources.

            Peter

            • 3. Re: how to config one database for serveral datasources?
              jali

               

              "kaobe" wrote:
              Hi,

              either you define n *-ds.xml files, each defining one database connection, or you use one -ds.xml file that defines the n connections to the database. Inside the datasources tag you can define n datasources.

              Peter


              thanks for your reply.
              this is my mysql-ds.xml in the folder of the default deploy.
              but i don't know how to config standardjbosscmp-jdbc.xml file because in this file there is only one default property "datasource". how to set three databases.

              standardjbosscmp-jdbc.xml:

              .....

              java:/A
              <datasource-mapping>mySQL</datasource-mapping>
              ......

              mysql-ds.xml:


              <local-tx-datasource>
              <jndi-name>A</jndi-name> <connection-url>jdbc:mysql://localhost:3306/A</connection-url>
              <driver-class>com.mysql.jdbc.Driver</driver-class>
              <user-name>root</user-name>

              </local-tx-datasource>

              <local-tx-datasource>
              <jndi-name>B</jndi-name>
              <connection-url>jdbc:mysql://localhost:3306/B</connection-url>
              <driver-class>com.mysql.jdbc.Driver</driver-class>
              <user-name>root</user-name>

              </local-tx-datasource>

              <local-tx-datasource>
              <jndi-name>C</jndi-name>
              <connection-url>jdbc:mysql://localhost:3306/C</connection-url>
              <driver-class>com.mysql.jdbc.Driver</driver-class>
              <user-name>root</user-name>

              </local-tx-datasource>