Datasource configuration in Jboss 7 for connection pooling

Datasource configuration in Jboss 7 for connection pooling

In this article I will expalin you the datasource configuration in Jboss Application Server 7.
Datasource configuration in Jboss AS 7 is completely different from the earlier versions of the Jboss application servers.
If you are using Jboss AS 7, I hope this small writeup will help you for the datasource configuration for the connection pooling
for your application.

My Assumptions
I assume that you have correctly installed Jboss application server version 7 which is called “lightening” and you have corrctly set the
environment variable “JBOSS_HOME”

In order to configure the datasource in Jboss AS 7, refer to the following steps.
Before proceeeding into the steps, let us refer to the environment variable for Jboss.
In case, I have set the environment variable for Jboss AS 7 as “JBOSS_HOME” as key and value is “F:/dev/jboss-as-web-7.0.0.Final”

Step 1. Go to the directory “modules” inside your jboss app server 7.
Example is given below.
Modules directory will be “%JBOSE_HOME%/modules”
In my case it is like the following.
Screen shot is given below.

You will be able to see many directories.

Step 2. Go to the directory “com” inside “${JBOSS_HOME}/modules” and create the following directories.

For example your final directory structure will be like this
See the below screen shot.

Step 3. Create an xml file called “module.xml” and the contents of this file will be the following.

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

See the below screen shot.

Step 4. Copy the jar file for mysql ie “mysql-connector-java-5.1.15.jar” to the location “${JBOSS_HOME}/modules/com/mysql/main”
For example the location of your “mysql-connector-java-5.1.15.jar” will be located like this

See the below screen shot

Step 5. Go to the directory “${JBOSS_HOME}/standalone/configuration” and open the file “standalone.xml” in your favorite xml supported editor.
For example the location of you “standalone.xml” is given below.

Step 6. Open the above xml file and search for the xml tag “<drivers>” and add below the following xml snippets below the “<drivers>” tag

<driver name=”com.mysql” module=”com.mysql”>

It means you have added driver details for the database connection. In this case I have added driver details for mysql.
The screen shot is given below.

Step 7. Start the Jboss Application Server  7 and configure your datasource from admin console of Jboss Application server by
selecting the driver.


I hope that this small article will help you to learn about the datasource and connection pooling in Jboss Application Server 7.



  1. surendra said,

    June 21, 2012 at 3:36 am

    Thanks Nice Post 🙂

  2. rajasekhar said,

    May 21, 2013 at 3:23 pm

    i need a program how to interact with jboss connection pool

  3. Pand005 said,

    July 18, 2013 at 11:27 am

    Sounds good. Thankyou!!!

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s