<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Programming &amp; Troubleshooting</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/alexfeng/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/alexfeng/feed.xml</link>
    <description>Focus on Microsoft development technologies and Windows Azure cloud platform</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:47:49 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>SQL Server Connection failed with jTDS JDBC Driver - SSPI handshake failed with error code 0x80090302, state 14 while establishing a connection with integrated security; the connection has been closed.</title>
      <link>https://docs.microsoft.com/archive/blogs/alexfeng/sql-server-connection-failed-with-jtds-jdbc-driver-sspi-handshake-failed-with-error-code-0x80090302-state-14-while-establishing-a-connection-with-integrated-security-the-connection-has-been-closed</link>
      <pubDate>Sun, 28 Jul 2013 18:38:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Feng [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexfeng/2013/07/28/sql-server-connection-failed-with-jtds-jdbc-driver-sspi-handshake-failed-with-error-code-0x80090302-state-14-while-establishing-a-connection-with-integrated-security-the-connection-has-been-closed/</guid>
      <description><![CDATA[This is a quick blog post about one error that I encountered earlier last week. One customer...]]></description>
      <content:encoded><![CDATA[<p>This is a quick blog post about one error that I encountered earlier last week. One customer has&nbsp;a web application from VMWare&nbsp;uses <a href="https://jtds.sourceforge.net/">jDTS</a> open source JDBC driver to connect with SQL Server, and it failed with the following error message:</p>
<p>2013-07-17 17:33:22.01 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error: 17806, Severity: 20, State: 14.<br />2013-07-17 17:33:22.01 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SSPI handshake failed with error code 0x80090302, 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.&nbsp; [CLIENT: xxx.xxx.xxx.xxx]. <br />2013-07-17 17:33:22.01 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error: 18452, Severity: 14, State: 1.<br />2013-07-17 17:33:22.01 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. [CLIENT: xxx.xxx.xxx.xxx]</p>
<p>&nbsp;</p>
<p>We think this might be a Kerberos authentication issue in the first place, however, after we configured the SPN which works for ODBC-JDBC and .Net Native Client drivers, but still not works for jTDS. We then involved VMware in this case, and find out that we need to add "<span style="background-color: #ffff00;"><strong>useNTLMv2=TRUE</strong></span>" to force the jTDS&nbsp;application to use NTMLv2 protocol while using Windows Authentication.</p>
<p>Hope this helps if you got the same issue.</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server cluster failover fails with Error Code: 0x80071398</title>
      <link>https://docs.microsoft.com/archive/blogs/alexfeng/sql-server-cluster-failover-fails-with-error-code-0x80071398</link>
      <pubDate>Tue, 23 Jul 2013 02:01:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Feng [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexfeng/2013/07/23/sql-server-cluster-failover-fails-with-error-code-0x80071398/</guid>
      <description><![CDATA[I have installed a 3-node SQL Server 2012 failover cluster on Windows Server 2012 few days ago, and...]]></description>
      <content:encoded><![CDATA[<p>I have installed a 3-node SQL Server 2012 failover cluster on Windows Server 2012 few days ago, and it has been running very well. Until today, I found that I could not manually failover the SQL cluster service from node 3 to node 1, and failed with the following information:</p>
<p><em>The operation has failed</em></p>
<p><em>The action 'Move' did not complete</em></p>
<p><em>The operation failed because either the specified cluster node is not the owner of the group, or the node is not a possible owner of the group</em></p>
<p>Here is a screenshot:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/79/5025.sql-failover-cluster-move-failed.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-79/5025.sql_2D00_failover_2D00_cluster_2D00_move_2D00_failed.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/79/5025.sql-failover-cluster-move-failed.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-79/5025.sql_2D00_failover_2D00_cluster_2D00_move_2D00_failed.png" alt="" border="0" /></a></p>
<p>The error is a bit strange to me as I can see the Node 1 was listed there when I performed the Move operation, and the cluster installation was successfully on all 3 nodes. At this point, I did some research, and found someone mentioned that the Node 1 might be not a possible owner for one or more of SQL Server failover cluster dependencies. After several clicks, I found that the failed Node 1 was not a possible owner of IP address of SQL Server virtual server name like below, once I selected it back, the failover succeeded.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/79/1537.possible_owners.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-79/1537.possible_5F00_owners.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/79/1537.possible_owners.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/350x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-79/1537.possible_5F00_owners.png" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>Hope this helps :-)</p>]]></content:encoded>
    </item>
    <item>
      <title>An example to PIVOT on a column with undermined unique values</title>
      <link>https://docs.microsoft.com/archive/blogs/alexfeng/an-example-to-pivot-on-a-column-with-undermined-unique-values</link>
      <pubDate>Wed, 10 Jul 2013 06:39:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Feng [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexfeng/2013/07/10/an-example-to-pivot-on-a-column-with-undermined-unique-values/</guid>
      <description><![CDATA[SQL Server T-SQL PIVOT is a great feature that you can turn the unique values from one column into...]]></description>
      <content:encoded><![CDATA[<p>SQL Server <a href="https://msdn.microsoft.com/en-us/library/ms177410(SQL.105).aspx">T-SQL PIVOT</a> is a great feature that you can turn the unique values from one column into multiple into multiple columns in the output table result. It also works great if you can iterate all unique values in the column to be pivoted , but the problem is that sometimes you don't know that information, or you have multiple unique values which is difficult to list all of them in the query.</p>
<p>With help from my friend (many thanks to Stephanie), it is easy to address this problem using <a href="https://msdn.microsoft.com/en-us/library/ms189885.aspx">FOR XML PATH</a>. Here is an example based on AdvenutreWorks2012 sample database:</p>
<pre class="scroll"><code class="mysql"> use [AdventureWorks2012];<br /> go<br /> <br /> set nocount on;<br /> <br /> -- For each product sub category, get avergae cose for differnt DaysToManufacture<br /> DECLARE @cols AS NVARCHAR(MAX),<br /> @query AS NVARCHAR(MAX);<br /> <br /> SET @cols = STUFF((SELECT distinct ',' + QUOTENAME(p.DaysToManufacture) <br /> FROM Production.Product as p<br /> FOR XML PATH(''), TYPE<br /> ).value('.', 'NVARCHAR(MAX)') <br /> ,1,1,'')<br /> <br /> set @query = 'SELECT ProductSubcategoryID, ' + @cols + ' from <br /> (<br /> select p.ProductSubcategoryID<br /> , p.DaysToManufacture<br /> , p.StandardCost<br /> from Production.Product as p<br /> where p.ProductSubcategoryID IS NOT NULL<br /> ) x<br /> pivot <br /> (<br /> avg(StandardCost)<br /> for DaysToManufacture in (' + @cols + ')<br /> ) p '<br /> <br /> execute(@query);<br /> </code></pre>
<p>Hope it helps!</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server can't start after accidently set the "max server memory" to 0</title>
      <link>https://docs.microsoft.com/archive/blogs/alexfeng/sql-server-cant-start-after-accidently-set-the-max-server-memory-to-0</link>
      <pubDate>Sun, 07 Jul 2013 07:46:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Feng [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alexfeng/2013/07/07/sql-server-cant-start-after-accidently-set-the-max-server-memory-to-0/</guid>
      <description><![CDATA[One of my customer accidently set the "max server memory" of SQL Server to 0, and then the server...]]></description>
      <content:encoded><![CDATA[<p>One of my customer accidently set the "max server memory" of SQL Server to 0, and then the server can't start after that. If we try to start SQL Server from SQL Server Configuration Manager, it failed to start (esp. when you have several active databases), and in the SQL Server error log file, we could find a error message like "... a internal query can't be executed due to inefficient memory...". Or, sometimes, SQL Server can be started, but we can't create a connection to it with the following error message:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/79/4527.ConnectionError.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-79/4527.ConnectionError.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/79/4527.ConnectionError.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-79/4527.ConnectionError.png" alt="" border="0" /></a></p>
<p>In this case, we could add <strong>-f</strong> to SQL Server startup parameters which allows SQL Server to start with minimum configurations therefore uses least memory. After SQL Server starts, we could connect to SQL Server using SQL Server Management Studio and update the "max server memory" to an appropriate larger value.</p>
<p>A bit more details: if we set the "max server memory" to 0 via SSMS-&gt; Server's Properties -&gt; Memory, SSMS will automatically adjust the value to minimum account of memory for option "max server memory"; for SQL Server 2005-2008 R2, it's16MB, and for SQL 2012, it's 64MB for 32-bit, and 128MB for 64-bit server box; if we set the "max server memory" to 0 via sp_configure stored procedure directly, SQL Server will automatically use default "max server memory" value which is 2147483647MB.</p>
<p>References:<br />Server memory server configuration options: <a href="https://msdn.microsoft.com/en-us/library/ms178067(v=sql.110).aspx.">https://msdn.microsoft.com/en-us/library/ms178067(v=sql.110).aspx.</a><br />How to: Start an instance of SQL Server: <a href="https://msdn.microsoft.com/en-us/library/ms180965(v=sql.105).aspx">https://msdn.microsoft.com/en-us/library/ms180965(v=sql.105).aspx</a></p>
<p>Hope this helps!</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>