3 Replies Latest reply on Jan 27, 2004 3:49 PM by nmartel

    MySql Datasource Configuration

    carlos.gurgel

       

      "carlos.gurgel" wrote:
      I wanna know how files are involved in the process of create a MySQL Datasource in JBoss 3.2.
      I have been trying many solutions of various tutorials but doesn't work.

      I tryed create just the mysql-ds.xml file like this:

      <datasources>
       <local-tx-datasource>
       <jndi-name>MySqlDs</jndi-name>
       <connection-url>jdbc:mysql:///appDB</connection-url>
       <driver-class>org.gjt.mm.mysql.Driver</driver-class>
       <user-name>root</user-name>
       <password></password>
       <min-pool-size>1</min-pool-size>
       <max-pool-size>3</max-pool-size>
       <blocking-timeout-millis>10000</blocking-timeout-millis>
       <idle-timeout-minutes>15</idle-timeout-minutes>
       </local-tx-datasource>


      , edit the standardjaws.xml:

      <jaws>
       <datasource>java:/MySqlDs</datasource>
       <type-mapping>MySqlDs</type-mapping>
       <debug>false</debug>
       ...
       </jaws>


      and the standardjbosscmp-jdbc.xml:

      <jbosscmp-jdbc>
       <datasource>java:/MySqlDs</datasource>
       <datasource-mapping>MySqlDs</datasource-mapping>
       ...
       <\jbosscmp-jdbc>


      Everything seems that will going fine:

      22:08:51,117 INFO [MySqlDs] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=MySqlDs to JNDI name 'java:/MySqlDs'
      22:08:51,127 INFO [TxConnectionManager] Started jboss.jca:service=LocalTxCM,name=MySqlDs


      But when i deploy my app-ejb.jar, i get this error:

      22:08:56,174 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc.xml : datasource-mapping MySqlDs not found



      Any ideas?

      Grato,
      Carlos


        • 1. Re: MySql Datasource Configuration
          nmartel

          Try changing you container managed persistance bean like this:

          <jbosscmp-jdbc>


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

          <type-mapping>
          mySQL
          <row-locking-template>SELECT ?1 FROM ?2 WHERE ?3 FOR UPDATE</row-locking-template>
          <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template>
          <fk-constraint-template>ALTER TABLE ?1 ADD INDEX ind_?2 (?3), ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template>
          <auto-increment-template>?1 auto_increment</auto-increment-template>
          <alias-header-prefix>t</alias-header-prefix>
          <alias-header-suffix>_</alias-header-suffix>
          <alias-max-length>32</alias-max-length>
          <subquery-supported>false</subquery-supported>
          <true-mapping>1</true-mapping>
          <false-mapping>0</false-mapping>
          ...

          The data source is specified first... this is where your camel-case name goes.

          The db mapping types come next. The second arg needs to be "mySQL" to match the translations or mappings portion. Make sure that you have the "mySQL" mappings further down in the CMP configuration file.

          • 2. Re: MySql Datasource Configuration
            nmartel

            Marc F... fix this posting code.... it keeps mangling the posts!

            <jbosscmp-jdbc>


            java:/DefaultDS
            <datasource-mapping>mySQL</datasource-mapping>

            The first portion of my prior post should look like the above.

            • 3. Re: MySql Datasource Configuration
              nmartel

              Sorry the posts aren't working right!

              Talk to the JBoss folks.

              The less than/greater than appear to cause problems to the parsing/posting code.

              Also, the web master ignores any email you send.
              Last gripe... no webmaster contact on the web site!!!