<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pearl Tech &#187; SQL</title>
	<atom:link href="http://blog.pearltechnology.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pearltechnology.com</link>
	<description></description>
	<lastBuildDate>Thu, 05 Jan 2012 14:47:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Monday morning fun with SQL Server and Service Principal Names (SPNs)</title>
		<link>http://blog.pearltechnology.com/monday-morning-fun-with-sql-server-and-service-principal-names-spns/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/monday-morning-fun-with-sql-server-and-service-principal-names-spns/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 15:00:36 +0000</pubDate>
		<dc:creator>LoganS</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=31</guid>
		<description><![CDATA[I arrived at a client’s office one Monday morning only to find absolute chaos. We had users and applications on servers giving the lovely “Cannot Generate SSPI Context” error all across the organization. At first I wasn’t too worried.  I instantly assumed DNS was the culprit, as this SQL server has been in production for  [...]]]></description>
			<content:encoded><![CDATA[<p>I arrived at a client’s office one Monday morning only to find absolute chaos. We had users and applications on servers giving the lovely “Cannot Generate SSPI Context” error all across the organization. At first I wasn’t too worried.  I instantly assumed DNS was the culprit, as this SQL server has been in production for  around 6 months. Well, to say the least, that was a quick 5 minute check and all looked fine. Moving forward, I decided to change some of the System DSNs to use Named Pipes instead of TCP/IP. This is where we had success, and this is what we implemented for our applications/users as a temporary workaround until we were able to successfully resolve the SSPI error. Below you’ll find the steps I performed to fix this problem.</p>
<p><strong>Problem</strong>:<br />
Connecting to a SQL database using Windows Authentication over TCP/IP returns the error “Cannot generate SSPI context” whether it’s the application, or when you’re, setting up a User or System DSN for Microsoft SQL, for example.</p>
<p><strong>Workaround:</strong><br />
If you change the DSN to use Named Pipes instead of TCP/IP on the client configuration area of the setup, the SQL Server connection will succeed.</p>
<p><strong>How to troubleshoot the &#8220;Cannot generate SSPI context&#8221; error message</strong><a href="http://support.microsoft.com/kb/811889"><br />
http://support.microsoft.com/kb/811889</a></p>
<p><strong>Security Account Delegation (Using the setspn.exe utility to view/add/delete SPNs)</strong><a href="http://msdn.microsoft.com/en-us/library/aa905162%28SQL.80%29.aspx"><br />
http://msdn.microsoft.com/en-us/library/aa905162(SQL.80).aspx</a></p>
<p><strong>Solution:</strong></p>
<ol>
<li>Stop the SQL Server service</li>
<li>Downloaded and installed the SetSPN utility found in the Windows Server 2000 Resource Kit Tools. <a href="http://www.microsoft.com/downloads/details.aspx?familyid=5fd831fd-ab77-46a3-9cfe-ff01d29e5c46&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=5fd831fd-ab77-46a3-9cfe-ff01d29e5c46&amp;displaylang=en</a>
<ol>
<li>Installed on Standard Server 2003</li>
</ol>
</li>
<li>Run the setspn.exe utility from the resource kit command prompt. You want to use a <strong>–l username</strong> or <strong>–l computername</strong>. This will only LIST the current SPNs configured for either account. (You’ll want to use the <strong>–l computername</strong> if the SQL Server Service is running as LocalSystem OR a regular domain user) If the SQL Server Service is running as an administrative account (Domain Administrators/SQL Administrator) you would want to use the <strong>–l username</strong> to see the SPNs registered for that account.
<ol>
<li><strong>Setspn.exe –l clientdomain\Administrator</strong> and <strong>setspn.exe</strong> <strong>–l SQLSERVER1</strong>
<ol>
<li>This showed multiple conflicting or non-updated SPN records for the both the user account and the computer account</li>
</ol>
</li>
</ol>
</li>
<li>Ran <strong>setspn –D</strong> <strong>MSSQLSvc/SQLSERVER1.clientdomain.local:1433 Administrator </strong>(Run as domain admin) to manually delete all SPN records for anything that had to deal with SQLSERVER1.
<ol>
<li>In this client’s case, SQL had been setup to run as the domain Administrator, so I listed all SPNs for both the Administrator and the SQL Server hostname. Then manually deleted all registered SPNs for both the Administrator account, and the SQL server hostname.</li>
</ol>
</li>
<li>For the time being, I also went ahead and changed the SQL services to run as LocalSystem.</li>
<li>Since the services are now configured to run as LocalSystem, you want to make sure to mark the computer account of the SQL Server as <strong>Trust for Delegation (Kerberos only)</strong> on the Delegation Tab of the computer properties in AD.</li>
<li>Reboot SQL server – This will ensure when SQL Server starts, it will attempt to register it’s SPN with your DC.</li>
<li>At this point I was able to successfully connect to all the database using Windows/Integrated Authentication over TCP/IP</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/monday-morning-fun-with-sql-server-and-service-principal-names-spns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

