1. Add User to WildFly for JDBC Datasource configuration
- go to {wildfly-8.2.0}\bin
- run add-users.bat
- follow the instructions for cuser creating
2. Add MySQL Driver to WildFly
- Download the mysql-driver mysql-connector-java-{last_version}.jar from any Maven Repository e.g.: http://repo1.maven.org/maven2/mysql/mysql-connector-java/
- go to WildFly modules Directory:
cd {wildfly-8.2.0}/modules/system/layers/base
mkdir -p mysql/mysql-connector-java/maincopy mysql-driver mysql-connector-java-{last_version}.jar here.
- add a file module.xml with content:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1"
name="mysql.mysql-connector-java">
<resources>
<resource-root path="mysql-connector-java-5.1.22.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module> -
Add Driver in standalone.xml
cd {wildfly-8.2.0}/standalone/configuration/
edit standalone.xmladd to drivers:
<driver name="com.mysql" module="mysql.mysql-connector-java">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
3. Add Datasource to WildFly
- open http://localhost:9990/console/App.htm
- go to Connector->Datasources
- add new Datasource
- Give the name and JNDI name.
- choose your created driver
- enter your connection URL like: jdbc:mysql://localhost/mydatabase and database cridentials
- test your connection