我正在尝试在我的standalone.xml 文件中设置多个数据源。我与 DB2 建立了连接并且工作正常。我无法让 SQL Server 连接正常工作。
从standalone.xml:
<datasource jndi-name="java:/jdbc/syteline" pool-name="SYTELINEMSSDS" enabled="true" use-java-context="true" spy="true">
<connection-url>jdbc:sqlserver://SLSQL:1433;databaseName=npsl_pilot_app;</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqljdbc4.jar</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
<use-strict-min>false</use-strict-min>
</pool>
<security>
<user-name>myUser</user-name>
<password>myPass</password>
</security>
<timeout>
<idle-timeout-minutes>15</idle-timeout-minutes>
</timeout>
</datasource>
我在我的standalone\deployments 目录中部署了 sqljdbc4.jar,它正在部署。我通过将连接 URL 和凭据复制/粘贴到我的应用程序并在我的代码中创建 JDBC 连接来测试连接 URL 和凭据。该连接正常工作。在standalone.xml 中将连接设置为数据源给了我以下信息:
15:20:00,326 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-15) JBAS010400: Bound data source [java:/jdbc/syteline]
15:20:00,684 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:758) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final]
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.fillToMin(SemaphoreArrayListManagedConnectionPool.java:703) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final]
at org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_23]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'dna'. ClientConnectionId:4e4e0e7f-3e23-4a13-9c49-37e33aeb4613
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)
... 5 more
15:20:01,385 WARN [org.jboss.as.server.deployment] (MSC service thread 1-14) Class Path entry jcifs.jar in "/C:/jbossdir/jboss7/standalone/deployments/speed2.war/WEB-INF/lib/jtds-1.2.5.jar" does not point to a valid jar for a Class-Path reference.
我无法弄清楚登录失败消息。