Configure mysql datasource in wildfly 8.0

Add mysql module to wildfly application server:

1. Go to wildfly-8.0.0.Final\modules\system\layers\base\com
2. Create folder like “sql\mysql\main\” and go to sql\mysql\main\
3. Place mysql connector jar to main folder
4. Place module.xml file to main folder

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

Add datasource to wildfly configuration file

1. Go to C:\Program Files\wildfly-8.0.0.Final\wildfly-8.0.0.Final\standalone\configuration
2. Open standalone.xml file (we assume you are using standalone.xml as server configuration file)
3. Add following code to datasources section

	<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
	<datasource jndi-name="java:jboss/datasources/brachub" pool-name="brachub" enabled="true" use-java-context="true">
		<driver name="mysql" module="com.sql.mysql">
		<driver name="h2" module="com.h2database.h2">

Hope this will work.


6 thoughts on “Configure mysql datasource in wildfly 8.0”

  1. I think I tried above setting and this version of the my sql actually doesnt work well with the wild fly 8.1.0 it never worked for me. I had to download the latest version to solve the issue. but it is good sample for the configuration need to be done for the mysql connector. or jdbc driver.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s