Installing the JDBC driver in WildFly
Database connectivity is carried out in Java using JDBC drivers, which are used either dir-
ectly in your applications or behind the scenes in JPA. The PostgreSQL JDBC driver can
be downloaded for free from http://jdbc.postgresql.org/download.html .
Once the download is complete, place the postgresql-9.X-X.jdbc41.jar file at a
convenient location on your filesystem. We will now see how to install the JDBC driver in
In JBoss AS 5 and 6, you used to install the JDBC driver in the common/lib folder of
your server distribution. In the new modular server architecture (introduced in JBoss AS 7),
you have more than one option to install your JDBC driver. The recommended approach
consists of installing the driver as a module.
The procedure to install a new module requires creating a module path under
JBOSS_HOME/modules and placing the .jar libraries and the module.xml file (that
declares the module name and its dependencies) there.
In our example, we will add the following units to our filesystem:
Start by simply creating the required directories in your WildFly installation (to which the
JBOSS_HOME variable points), and copying the downloaded JAR file to them.
Now, in the main folder, add a file named module.xml . This file contains the actual
module definition; the most interesting part of it is the module name
( org.postgresql ), which corresponds to the module attribute defined in your data
Next, you need to state the path to the JDBC driver resource and the module dependencies,
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
<resource-root path= "postgresql-9.3-1101.jdbc41.jar "/>
Search WWH ::