Connect WildFly 8.x Application Server to a Microsoft SQL Server 2014

This post describes how to connect a WildFly 8.x Application Server to a Microsoft SQL Server 2014 using JPA. Background is the usage of the database via Hibernate.

Download driver

Download “Microsoft JDBC Driver 6.0 for SQL Server” from

Get the driver file “sqljdbc42.jar” for your appropriate Java version (for example /enu/jre8/).

Module configuration

Create the following directory structure, if it not exists.

At least  {WILDFLY_HOME}/modules/system/layers/base/ should be already exist.

Place the file “sqljdbc42.jar” into this folder and create the file “module.xml” with the following content.

Restart the application server.

Configure driver for usage in datasources

As an abstract name for the usage of the driver we choose “sqlserver” and propagate it to WildFly either by adding it to the standalone.xml or by using the JBOSS-CLI.

1 standalone.xml

Add the following XML to the datasources-section.


The outcome should be “success”.

Verify the configuration


Using the JBOSS-CLI the proper loading of the driver can be verified by the following command

The command should show an output like the following

Outcome should be “success” and driver-name should be “sqlserver”.

2 Logfiles

During startup WildFly should log something like

Datasource configuration

Add the datasource to you standalone.xml and restart the WildFly.

To check if all works properly use the Admin-UI or, again, the JBOSS-CLI.

Outcome should be the following:

JPA and persistence.xml

To access the datasource via JPA the persistence.xml should look like this. Don’t forget to replace the placeholder  <unit-name> and with <datasource-name>  the aproriate values for you environment.


ClassNotFoundException: javax.xml.bind.DatatypeConverter

During setup you may experience the error message

The solution for this problem is to extend the dependencies section of the module.xml by