This is another option to install the JDBC Driver as a module. Which requires that we define a new module for our JDBC Driver inside “${JBOSS_AS7}/modules” directory as following:

Suppose if we want to install the Oracle JDBC Driver (ojdbc6.jar) then we will need to do the following steps:

Step 1) Create a directory “oracle/jdbc/main” inside the “jboss-as-7.0.1.Final/modules” directory.

Step 2) Paste your “ojdbc6.jar” oracle Jdbc Driver inside “jboss-as-7.0.1.Final/modules/oracle/jdbc/main” directory.

Step 3)  Create a file “module.xml” inside “jboss-as-7.0.1.Final/modules/oracle/jdbc/main” as following:

<?xml version=”1.0″ encoding=”UTF-8″?>

<module xmlns=”urn:jboss:module:1.0″ name=”oracle.jdbc”>

    <resources>

        <resource-root path=”ojdbc6.jar”/>

    </resources>

    <dependencies>

        <module name=”javax.api”/>

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

    </dependencies>

</module>

Step 4)  Now open your “jboss-as-7.0.1.Final/standalone/configuration/standalone.xml” file or “jboss-as-7.0.1.Final/domain/configuration/domain.xml” file and then add the driver declaration tag refering to your module as following, by default you will see the driver declaration tag already contains the declaration for <driver name=”h2? module=”com.h2database.h2?>:

<drivers>

    <driver name=”OracleJDBCDriver” module=”oracle.jdbc” />

    <driver name=”h2″ module=”com.h2database.h2″>

        <xa-datasource-class>

            org.h2.jdbcx.JdbcDataSource

        </xa-datasource-class>

    </driver>

</drivers>

Here we declared the <driver name=”OracleJDBCDriver” module=”oracle.jdbc”/>

Step 5)  Create a DataSource in your JBoss AS 7 and then in the Driver section you can refer to this Module name “oracle.jdbc”

Creating a DataSource from JBoss AS 7 Admin Console

Step 1) After installing the JDBC Driver as mentioned above start your JBoss AS 7 and then login to the admin-console from URL: “http://localhost:9990/console” (as admin/admin credentials)

Step 2) From left hand panel of the console click on “Connectors—>DataSources”

 

JBoss-DS1

 

 

 

 

 

 

 

 

 

 

JBoss-DS2

JBoss-DS3

JBoss-DS4

JBoss-DS5

JBoss-DS6

JBoss-DS7

JBoss-DS8