SQL Server SSPI handshake failed报错

一、 报错内容

Logon       Error: 17806, Severity: 20, State: 14.
Logon       SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure. The logon attempt failed   [CLIENT: 192.168.1.3]

Logon       Error: 18452, Severity: 14, State: 1.
Logon       Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. [CLIENT: 192.168.1.3]

二、 报错原因

从报错信息看应该跟域账号有关系,域账号不受信任,所以无法使用windows验证。

常见于192.168.1.3中曾用A用户(遇到的情况是域账号)连接到数据库,后来A用户密码被修改,但192.168.1.3中仍在使用旧密码尝试连接,导致登录验证报错。

另外遇到过一个情况是A用户的域账号被锁定了,登录时会报这个错误。

三、 解决方法

登录192.168.1.3服务器断开以前使用A用户的连接

或者

登录数据库服务器kill掉A用户的连接

参考

Boring article about fixing a 'Login failed... untrusted domain' issue when connecting to SQL Server. (secretGeek.net)

Common ‘SSPI handshake failed’ errors and troubleshooting | Microsoft Learn

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
using System; using System.Data; using System.Configuration; using System.Data.OleDb; namespace xxxxx { /// <summary> /// Access数据库访问类 /// </summary> public class DataAccess { private static OleDbConnection conn = new OleDbConnection(); private static OleDbCommand comm = new OleDbCommand(); private static string asscessPath = @".\PoliScan.mdb"; /// <summary> /// 设置Access数据库路径 /// </summary> /// <param name="path">完整的路径字符串</param> public static void SetAccessPath(string path) { asscessPath = path; } /// <summary> /// 打开数据库 /// </summary> /// <returns>成功返回 true;失败返回 false;异常抛出异常</returns> public static bool OpenConnection() { bool retval = false; if (conn.State != ConnectionState.Open) { conn.ConnectionString = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + asscessPath; comm.Connection = conn; try { conn.Open(); if (conn.State == ConnectionState.Open) { retval = true; } } catch (Exception e) { throw new Exception(e.Message); } ............................ ............................ using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; using System.Data.SqlClient; /// <summary> /// DataBase 的摘要说明 /// </summary> public class DataBase : IDisposable { public DataBase() { // // TODO: 在此处添加构造函数逻辑 // } private SqlConnection con; //创建连接对象 #region 打开数据库连接 /// <summary> /// 打开数据库连接. /// </summary> private void Open() { // 打开数据库连接 if (con == null) { con = new SqlConnection("Data Source = . ;Database = CET ;Integrated Security = SSPI "); } if (con.State == System.Data.ConnectionState.Closed) con.Open(); }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Hehuyi_In

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值