[英]Microsoft SQL Server: “Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.”
I tried to connect to Microsoft SQL Server and it gives me the error Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. ClientConnectionId:f5448d0d-950a-45b3-842f-9d2c6ac86ccd
我尝试连接到Microsoft SQL Server,但出现错误“
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. ClientConnectionId:f5448d0d-950a-45b3-842f-9d2c6ac86ccd
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. ClientConnectionId:f5448d0d-950a-45b3-842f-9d2c6ac86ccd
When I run netstat -na
and I found a listening with a port of 1433 but still, the connection with Java doesn't work. 当我运行
netstat -na
,我发现侦听端口为1433,但仍然无法与Java建立连接。
My code: 我的代码:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connnectionUrl = "jdbc:sqlserver://localhost:1434;database=Northwind;integratedSecurity=true;";
con = DriverManager.getConnection(connnectionUrl);
Full stacktrace: 完整的堆栈跟踪:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. ClientConnectionId:f5448d0d-950a-45b3-842f-9d2c6ac86ccd
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:254)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:258)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:104)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4772)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3581)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:81)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3541)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7240)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2869)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2395)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2042)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1889)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1120)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:700)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at jdbc.Temp.main(Temp.java:18)
您是否遵循了此说明
By default MS SQL Server does not listen on outside address. 默认情况下,MS SQL Server不侦听外部地址。 The following link could be helpful
以下链接可能会有所帮助
https://knowledgebase.apexsql.com/configure-remote-access-connect-remote-sql-server-instance-apexsql-tools/ https://knowledgebase.apexsql.com/configure-remote-access-connect-remote-sql-server-instance-apexsql-tools/
https://support.plesk.com/hc/en-us/articles/213407669-How-to-enable-remote-connections-to-MS-SQL-server- https://support.plesk.com/hc/en-us/articles/213407669-How-to-enable-remote-connections-to-MS-SQL-server-
Solved it. 解决了。 it was because my PC name and Windows User was in Hebrew, changed it to English and it worked.
这是因为我的PC名称和Windows用户使用希伯来语,所以将其更改为英语,并且可以正常工作。 also, check in the sql server path there aren't any folders named in Hebrew Thank you, everyone, who helped.
另外,请在sql服务器路径中检查希伯来语中没有命名的任何文件夹。谢谢大家的帮助。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.