-
Download connector jar from mysql
http://dev.mysql.com/downloads/connector/j/
-
Unzip the downloaded file and copy the file mysql-connector-java-*-bin.jar to the new folder
WILDFLY_HOME/modules/system/layers/base/com/mysql/main
- create the file module.xml in the same folder with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-<version here>-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
- Connect to console via jboss-cli and type
/subsystem=datasources/jdbc-driver=mysql:add(
driver-name=mysql,
driver-module-name=com.mysql,
driver-class-name=com.mysql.jdbc.Driver
)
- Follow example jndi name when creating a new datasource
java:jboss/datasources/<app name>