Datasource Configuration In Jboss 7

Follow the below steps to add datasource in jboss 7

1. edit standalone.xml to add datasource in subsystem

Note: standalone.xml location jboss-as-7.1.1.Final/standalone/configuration

 <datasource jndi-name="java:/jdbc/mydatasource" pool-name="mydatasource" enabled="true" use-java-context="true">

2. Add the MySql Driver in the same place

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

3. Create following folder structure in jboss module directory.


4. create module.xml file with following entry

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql.jdbc">
        <resource-root path="mysql-connector-java-5.1.21.jar"/>
        <!-- Insert resources here -->
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>

5. add mysql connector jars. finally main folder should contain below files


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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