0 Replies Latest reply on Mar 13, 2005 10:33 PM by George Berish

    Why Can't I Use Two Databases?

    George Berish Novice

      Hi;

      I configured JbBoss to use MySql and created two databases therein:
      jbossdb
      go

      I'd really like to have JBoss use jbossdb for jms_message, jms_roles, jms_subscriptions, jms_transactions and jms_users tables.

      And I'd like JBoss to use go for my bean persistance tables: games, members, plays, names.

      Here is what I tried, but my bean tables still end up in jbossdb.
      standardjbosscmp-jdbc.xml

      <jbosscmp-jdbc>
       <defaults>
       <datasource>java:/DefaultDS</datasource>
       <datasource-mapping>mySQL</datasource-mapping>
       ...
       </defaults>
       <type-mappings>
       <type-mapping>
       <name>mySQL</name>
       ....
       </type-mapping>
       </type-mappings>
      </jbosscmp-jdbc>
      mysql-ds.xml
      <datasources>
      
       <local-tx-datasource>
       <jndi-name>DefaultDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/jbossdb</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       ...
       </local-tx-datasource>
      
       <local-tx-datasource>
       <jndi-name>GoDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/go</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       ...
       </local-tx-datasource>
      </datasources>
      jboss.xml
      <jboss>
       <enterprise-beans>
       <!-- MemberBean -->
       <entity>
       <ejb-name>MemberEJB</ejb-name>
       <local-jndi-name>ejb/MemberLocalHome</local-jndi-name>
       <resource-ref>
       <res-ref-name>GoDS</res-ref-name>
       <jndi-name>java:/GoDS</jndi-name>
       </resource-ref>
       </entity>
       ...
       </enterprise-beans>
      </jboss>
      ejb-jar.xml
      <ejb-jar>
       ...
       <enterprise-beans>
       <!-- MemberBean -->
       <entity>
       ...
       <description>Member Bean Definition</description>
       ...
       <ejb-name>MemberEJB</ejb-name>
       ...
       <resource-ref>
       <description/>
       <res-ref-name>GoDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       <res-sharing-scope>Shareable</res-sharing-scope>
       </resource-ref>
       ...
       </entity>
       </enterprise-beans>
       ...
      </ejb-jar>
      It seems like I should be able to map GoDS to mysql in standardjboss-cmp-jdbc, but I can't see how.

      Can anyone help straighten me out?

      Thanx,
      glb