Previous Topic Next topic Print topic


Install and Configure a JDBC Driver

Download and install a SQL Server JDBC driver to use in this tutorial; then make the driver available to the JBoss application server.

Install a JDBC Driver

As this tutorial uses SQL Server, you need a SQL Server-compatible JDBC driver. Download a Microsoft JDBC SQL Server Type 4 driver using this link, and install it using the Install Instructions on the download page:

Download JDBC Drivers

The name of the driver file is sqljdbc4[n].jar where n is a single digit and is appended to the filename for some versions of the driver. Be sure to take note of the location of this file after installing it.

Configure the JDBC Driver in JBoss

To make the JDBC driver available to JBoss, you must place it in the appropriate directory, and configure it by creating an XML configuration file.

Copy the JDBC Driver to JBoss
To run your application, the JBoss application server must find an SQL Server JDBC driver file in a specific subdirectory of your JBoss installation directory. You must create the subdirectory and copy the sqljdbc4.jar file as follows:
  1. At a command prompt or using Explorer, change to your JBoss installation's modules\com directory.
  2. Create the following subdirectory structure:

    microsoft\sqlserver\main

  3. Change to the modules\com\microsoft\sqlserver\main directory.
  4. Copy the downloaded sqljdbc4.jar file to the modules\com\microsoft\sqlserver\main directory.
Create a module.xml file
The module.xml file provides JDBC driver configuration required by JBoss.
  1. In the modules\com\microsoft\sqlserver\main directory, create a new file, module.xml, using any text editor.
  2. Copy the following contents into the file:
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.0" name="com.microsoft.sqlserver">
         <resources>
              <resource-root path="sqljdbc4.jar"/>
         </resources>
         <dependencies>
              <module name="javax.api"/>
              <module name="javax.transaction.api"/>
         </dependencies>
    </module>
    
  3. Save the file and exit the editor.
Previous Topic Next topic Print topic