Pages

Tuesday, March 18, 2014

How to install mysql on jboss as a module

first create the folder structure <jboss directory>/modules/com/mysql/main
copy the the mysql connector jar to the folder
thlen add module.xml file to the same folder and add the following to the module.xml

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
  <resources>
     <resource-root path="mysql-connector-java-5.1.28.jar"/>            
  </resources>
  <dependencies>
     <module name="javax.api"/>
  </dependencies>
</module>

Note that the resource-root element's path should be the file name of the mysql connector jar

Now the final step

edit the standalone.xml file in standalone/configuration folder. then add the following in the drivers element.
<driver name="mysqlDriver" module="com.mysql">
                        <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                    </driver>

note the mysqlDriver is the name of the driver and you can use it to configure the data source.

No comments:

Post a Comment