The following tutorial is outdated. We suggest looking in these tutorials:

JBoss Datasource configuration

JBoss Datasource cheatsheet

Configuring a datasource with PostgreSQL and JBoss/WildFly

Configuring a Datasource with MySQL on WildFly

Demystifying Datasource JTA and XA settings on JBoss-WildFly

Creating a Datasource on WildFly 9 using templates

Creating a Datasource on JBoss-WildFly using a batch script


A datasource is defined into the datasources subsystem.

Datasources in JBoss AS 7 are not defined anymore using -ds.xml file as you did for earlier JBoss AS releases

A Datasource can be configured either from the Command Line Interface or from the server main configuration file (standalone.xml/domain.xml).

In In the following example, we are configuring a MySQL Datasource by adding a new com.mysql module which is registered in the server main configuration file.

<datasource jndi-name="java:/MySqlDS" pool-name="MySQLPool">
   <driver name="mysql" module="com.mysql"/>

Now you need to register the com.mysql module under the modules/com/mysql/main folder. There you need to add two files: the module.xml definition and the JDBC jar library.

¦   +---mysql
¦   ¦    +---main
¦   ¦    +-------module.xml  
¦   ¦    +-------mysql-connector-java-5.1.17.jar

The module.xml contains basically the module name, the resources used and its dependencies.

<module xmlns="urn:jboss:module:1.0" name="com.mysql">
     <resource-root path="mysql-connector-java-5.1.17-bin.jar"/>

      <module name="javax.api"/>
      <module name="javax.transaction.api"/>

Another available option is to install a JDBC driver into the application server is to simply deploy it as a regular JAR deployment.  
This is particularly useful when you are running your application server in domain mode. In such a scenario, your deployments are automatically propagated to all servers to which the deployment applies; thus distribution of the driver JAR is one less thing for administrators to worry about.
Any JDBC 4-compliant driver will automatically be recognized and installed into the system by name and version.

08:44:40,251 INFO  [] (MSC service thread 1-3) Starting deployment of "mysql-connector-java-5.1.17-bin.jar"
08:44:40,814 INFO  [] (MSC service thread 1-2) Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
08:44:40,857 INFO  [] (MSC service thread 1-5) Bound data source [java:/MySQLDS]
08:44:40,857 INFO  [] (MSC service thread 1-2) JBoss AS 7.0.0.CR1 "White Rabbit" started in 15257ms - Started 111 of 168 services (57 services are passive or on-demand)
08:44:40,922 INFO  [] (DeploymentScanner-threads - 2) Deployed "mysql-connector-java-5.1.17-bin.jar"


Related articles available on

How to deploy a DataSource in jboss at application level ?

  Do you need to deploy your DataSource along with your Enterpri

JBoss Datasource HA

This tutorial has been updated for the new release of JBoss Appli

JBoss run out of Connections ?

Have you got No ManagedConnections available error message ? well

How to connect to a DataSource from a remote client?

  If you want to connect to your JBoss Connection Pool from a re

JBoss Datasource configuration

A Datasource is a Java Naming and Directory Interface (JNDI) obje

How do I get the list of Datasources available ?

JBOSS AS 4/5 Users You can use either twiddle: $ que