SQL Server在Wildfly中使用Windows身份验证作为服务

时间:2017-01-12 15:59:15

标签: sql-server windows wildfly-10

我正在配置数据源以使用SQL Server进行Windows身份验证。

我把DLL sqljdbc_auth.dll放在C:\ Program Files \ XXXX \ wildfly-10.1.0.Final \ bin

使用standalone.bat说明Wildfly工作正常。

但是使用Windows服务我收到了这个错误:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "Scope_Build36" requested by the login. The login failed. ClientConnectionId:831c2f7f-4352-4467-b54f-a6eb1369d6e9
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
    at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:251)
    at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:81)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection$1LogonProcessor.complete(SQLServerConnection.java:2825)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:3079)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2360)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2346)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1404)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1068)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:904)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:451)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1014)
    at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
    ... 44 more

DataSource配置:

            <datasource jta="true" jndi-name="java:/datasources/PortalScopeWeb_Scope" pool-name="PortalScopeWeb_Scope" enabled="true" use-ccm="true">
                <connection-url>jdbc:sqlserver://RI001421D\SQLEXPRESS:1433;databasename=Scope_Build36;integratedSecurity=true</connection-url>
                <driver>sqlServer</driver>
                <security>
                    <security-domain>securityDomainPortalScopeWeb_Scope</security-domain>
                </security>
                <validation>
                    <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                    <validate-on-match>true</validate-on-match>
                    <background-validation>false</background-validation>
                </validation>
            </datasource>

将DDL放在文件夹C:\ Program Files \ XXXX \ wildfly-10.1.0.Final \ bin \ service \ amd64中没有解决问题。

1 个答案:

答案 0 :(得分:0)

您可以使用.udl文件来测试和验证您的连接。 在您的桌面上创建一个新的.txt文件,并将其重命名为&#34; test.udl&#34;。现在,打开它,您可以配置和测试您的连接。准备好连接后,可以使用记事本打开.udl文件并复制连接字符串。

这里有一个参考:udl reference

希望这有帮助!