Installing a JDBC driver as a module
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:
Step1). Create a directory “oracle/jdbc/main” inside the “jboss-as-7.0.1.Final/modules” directory.
Step2). paste your “ojdbc6.jar” oracle Jdbc Driver inside “jboss-as-7.0.1.Final/modules/oracle/jdbc/main” directory.
Step3). 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" >
Step4). 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
:
org.h2.jdbcx.JdbcDataSource
Here we declared the
Step5). Create a DataSource in your JBoss AS 7 and then in the Driver section you can refer to this Module name “oracle.jdbc”
有一点要注意,Jboss配置新数据源时,module.xml中的name一定要与实际路径一致,如目录结构为:$jboss_home\modules\com\oracle\jdbc\main,名称一定配置为:“com.oracle.jdbc”,否则找不到驱动
然后配置xa数据源,就可以选择sqlserver驱动了