我正在尝试在JBOSS EAP 6.4中为SQL Server 2014配置数据源,但是在测试连接时失败。我尝试从ECLIPSE连接到Sql Server,并且它可以正常工作,所以问题出在Jboss。
我的模块和罐子都在 C:\ jboss-eap-6.4 \ modules \ system \ layers \ base \ com \ sqlserver \ main
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.sqlserver">
<resources>
<resource-root path="sqljdbc42.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
JAR: sqljdbc42.jar
standalone-full.xml
<datasource jndi-name="java:/MSSQLDS" pool-name="MSSQLDS" enabled="true">
<connection-url>jdbc:sqlserver://localhost:1433;DatabaseName=motorNotificaciones</connection-url>
<driver>sqlserver</driver>
<security>
<user-name>sa</user-name>
<password>sa123</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="sqlserver" module="com.sqlserver"/>
</drivers>
测试连接错误(通过JBOSS控制台):
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "MSSQLDS")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "JBAS010440: No se logró invocar la operación: JBAS010447: La conexión no es válida",
"rolled-back" => true
}
答案 0 :(得分:0)
我发现了问题;我使用的是sqljdbc42,而jboss eap 6.4与版本4兼容。因此我将其替换,测试连接正常。