使用Windows身份验证连接到其他服务器上的SQL Server

问题描述 投票:0回答:1

从早上开始,我一直在努力将Java Web应用程序连接到不同系统上的数据库(使用Windows Auth)。

我设法从我的SSMS访问它,我转到Windows凭据管理器,并创建了与安装SQL Server的其他系统相同的凭据,以下是详细信息:

enter image description here

现在,当我在SSMS中使用IP(192.168.2.172)作为服务器名称时,我可以使用Windows Auth进行连接,但无法从Java Web应用程序访问相同的内容。我在下面的字符串中使用jtds,但是它不起作用。请帮助

<property name="url" value="jdbc:jtds:sqlserver://192.168.2.172:1433/realtime;useNTLMv2=true" />

我经常收到此错误:

Caused by: java.sql.SQLException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
        at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
        at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
        at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
        at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:649)
        at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
        at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
        at org.apache.commons.dbcp.BasicDataSource.valida
java sql-server ssms windows-authentication jtds
1个回答
0
投票

Microsoft JDBC Driver for SQL Server在所有平台上都支持通过Kerberos的Windows Auth,并且在Windows上使用Kerberos或NTLM的Type 2身份验证dll:Connecting with integrated authentication On Windows

© www.soinside.com 2019 - 2024. All rights reserved.