I am connecting to Windows Server 2008 R2 which has SQL server 2005 installed via ODBC from a client machine. Recently I started getting this error

Cannot generate SSPI Context.

I have gone through similar questions but have not got any helpful answer.

  • This is a very common error with a variety of causes. Usually my first port of call with this error is to check whether the users password has expired, account locked out or just out of touch with the domain controller.
    – Molenpad
    Mar 7 '17 at 7:45
  • A good thing to see to get more context is youtube.com/watch?v=C7tAowmu-DI Mar 7 '17 at 9:15
  • Are you using Windows authentication and working in a domain? If so, check that the client machine is working fine in the domain. Sometimes a reboot is enough
    – Petaflop
    Mar 7 '17 at 15:13
  • 1
    Can be one of these things: 1. Run this query: select auth_scheme, * FROM sys.dm_exec_connections and check the auth_scheme column, if kerberos is enabled for your server. if you can see just NTLM, then you have to register your sql server instance using the SPN command (ask a SA admin help on this). 2. if your TCP protocol uses a port different than 1433, include it in your ODBC. 3. Make sure your client computer is part of the same domain as your sql server, or switch your ODBC to use SQL Server authentication. Nov 27 '17 at 0:32
  • I had a similar issue recently and found that there were issues with the remote access configuration on the target server. You may want to Google remote access configuration, specifically for Windows Server 2008R2. It's a bit more involved than newer versions. Dec 27 '17 at 16:55

There is a problem with the SPN of the SQL Server. Look at the Microsoft Kerberos Configuration Manager tool. https://www.microsoft.com/en-us/download/details.aspx?id=39046

This will look at the SQL Server and tell you what the SPN issue is with the machine and provide you a script to resolve. The script will need to be run by someone with Domain Admin permissions. This tool essentially automates the manual steps found in this article. https://support.microsoft.com/en-us/help/811889/how-to-troubleshoot-the-cannot-generate-sspi-context-error-message

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.