mysql Jconnector configuration with wildfly 8.1.0 and issue with version mysql-connector-java-5.0.8

Version 1

    I was working on integrating the mysql data source with wild fly and I had wasted quiet a bit of time and I thought to share the details here so that some one else don't waste time on figuring out trivial thing.

     

    1. configure just like any module

    module/com.mysql/main/module.xml

     

    <?xml version="1.0" encoding="UTF-8"?>

    <module xmlns="urn:jboss:module:1.3" name="com.mysql">

       <resources>

         <resource-root path="mysql-connector-java-5.0.8-bin.jar"/>

       </resources>

       <dependencies>

          <module name="javax.api"/>

          <module name="javax.transaction.api"/>

       <module name="javax.servlet.api" optional="true"/>

        </dependencies>

    </module>

     

    module/com.mysql/main/<mysql jar file>

     

    2 . configure the standalone.xml with driver and datasource detials.

     

    <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="mysql-pool" enabled="true" use-java-context="true" use-ccm="true">

                        <connection-url></connection-url>

                        <driver>mysql</driver>

                        <security>

                            <user-name>root</user-name>

                        </security>

                    </datasource>

     

    <driver name="mysql" module="com.mysql">

                            <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</xa-datasource-class>

    </driver>

     

    Above setting although correct will not work and this is due to the error in the jdbc driver and please refer to the details below .

    http://bugs.mysql.com/bug.php?id=62038

     

    Use the latest driver and correct the config to below

     

    Driver Jar which Doesnt Not Work : mysql-connector-java-5.0.8-bin.jar

    Driver Jar which Works : mysql-connector-java-5.1.34-bin.jar

     

    Hope this helpful  to others .

     

    Thanks

    Sanjay Gautam