3 Replies Latest reply on Apr 22, 2002 9:26 AM by David Jencks

    Alternate DataSource Usage (MySQL)

    Tyson Newbie

      I am currently running JBOSS 2.4 and am having a problem getting the CMP bean to talk to the MySQL DB. If I go into the jboss.jcml file, make the appropriate entries, comment out the DefaultDS and Hypersonic entries, then make my mysql datasource the default one, it will connect to the database and that table fine. If I leave the hypersonic one as default, or try to reference mySQL as anything other than the default datasource, then I can see my data getting pushed into the hypersonic tables.

      I get the distinct impression that I have the jboss.jcml configured properly, but perhaps my ejb-jar.xml file isn't right?? I am getting the message when JBoss starts up that it is loading the MySQLDS datasource properly. Any help or advice would be greatly appreciated.

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
      <ejb-jar>
      <enterprise-beans>

      <ejb-name>Tbltest</ejb-name>
      messagestore.TbltestHome
      messagestore.Tbltest
      <ejb-class>messagestore.TbltestBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>messagestore.TbltestPK</prim-key-class>
      False
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>message</field-name>
      </cmp-field>
      <primkey-field />
      <resource-ref>
      <res-ref-name>jdbc/MySQLDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>


      <ejb-name>Tbltest</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Never</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      (and the jcml....)

      MySQLDS
      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
      jdbc:mysql://undertow/test
      sa
      sa
      0
      5





      -Thanks :)