首先安装sql server的驱动,偷懒,摘抄一段:
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"?>
<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>
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 <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”/>
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驱动了
在Jboss AS 7中配置XA数据源时,关键步骤是确保module.xml中的driver-name与实际模块路径匹配。例如,若模块路径为$jboss_homemodulescomoraclejdbcmain,则driver-name应设为'com.oracle.jdbc'。完成这一步后,就能成功选择并配置SQL Server的XA驱动。
&spm=1001.2101.3001.5002&articleId=15812031&d=1&t=3&u=42788f68bfd845cdba3f6093d7828019)
230

被折叠的 条评论
为什么被折叠?



