Saturday, April 22, 2017

The target principal name is incorrect. cannot generate sspi context

In this Article we will see how missing a small point can make uncomfortable.

One day Morning after coming to office I was trying to connect one of the SQL Server, but it is not allowing me to connect and below error popped up. I have the SA privileges on that instance. Not sure why it is not allowing me to connect. Previous day it worked fine.





I have asked other team mate to check whether he also facing the same issue. He successfully connected to the instance.
I searched about this error in google and found some forums/blogs are mentioning to flush dns. But if it is due to DNS SQL instance should not connect to others also.

I was searching for all the possible resolutions without success.

As a trail I have logged of from DB server and then reconnected to it. Surprisingly I am able to connect to the SQL Server without any issues.
Now I was thinking what went wrong and how logging off from the server resolved the issue.

Actually here I was missing one small point.

In our environment we need to connect servers through a terminal server.

Previous day after completing my work, instead of logging off or disconnecting from the DB server I just directly disconnected the terminal server.

On the next day when I connected to terminal server, password change pop up came and I changed the password.

After logging to the terminal server previous day's DB server connection was not closed. So it did not asked for the credentials in turn it was using old credentials. But when I try to connect SQL Server using Windows Authentication, SQL Server not accepting the credentials as the windows server credentials are old one.
Once after I logged off from the DB server and logged into it again with new credentials all the issues cleared.

This might seems silly issue but some times silly issues also eat our time.