<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'Best Practices', 'SQL Azure', and 'Data Professional'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=Best+Practices,SQL+Azure,Data+Professional&amp;orTags=0</link><description>Search results matching tags 'Best Practices', 'SQL Azure', and 'Data Professional'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Using the @ in SQL Azure Connections</title><link>http://sqlblog.com/blogs/buck_woody/archive/2011/06/21/using-the-in-sql-azure-connections.aspx</link><pubDate>Tue, 21 Jun 2011 13:49:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:36390</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p&gt;The other day I was working with a client on an application they were changing to a hybrid architecture &amp;ndash; some data on-premise and other data in SQL Azure and Windows Azure Blob storage. I had them make a couple of corrections - the first was that all communications to SQL Azure need to be encrypted. It&amp;rsquo;s a simple addition to the connection string, depending on the library you use.&lt;/p&gt;
&lt;p&gt;Which brought up another interesting point. They had been using something that looked like this, using the .NET provider:&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;Server=tcp:[serverName].database.windows.net;Database=myDataBase;&lt;/pre&gt;
&lt;pre class="alt"&gt;User ID=LoginName;Password=myPassword;&lt;/pre&gt;
&lt;pre class="alt"&gt;Trusted_Connection=False;Encrypt=True;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span class="cs_v"&gt;This includes most of the formatting needed for SQL Azure. It specifies &lt;strong&gt;TCP&lt;/strong&gt; as the transport mechanism, the &lt;strong&gt;database name&lt;/strong&gt; is included, &lt;strong&gt;Trusted_Connection&lt;/strong&gt; is &lt;strong&gt;off&lt;/strong&gt;, and &lt;strong&gt;encryption&lt;/strong&gt; is &lt;strong&gt;on&lt;/strong&gt;. But it needed one more change: &lt;/span&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;Server=tcp:[serverName].database.windows.net;Database=myDataBase;&lt;/pre&gt;
&lt;pre class="alt"&gt;User ID=[LoginName]@[serverName];Password=myPassword;&lt;/pre&gt;
&lt;pre class="alt"&gt;Trusted_Connection=False;Encrypt=True;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span class="cs_v"&gt;&lt;span class="cs_v"&gt;Notice the difference? It&amp;rsquo;s the &lt;em&gt;&lt;strong&gt;User ID&lt;/strong&gt; &lt;/em&gt;parameter. It includes the &lt;strong&gt;@&lt;/strong&gt; symbol and the &lt;strong&gt;name of the server&lt;/strong&gt; &amp;ndash; not the whole DNS name, just the server name itself. The developers were a bit surprised, since it had been working with the first format that just used the user name. Why did both work, and why is one better than the other?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="cs_v"&gt;&lt;span class="cs_v"&gt;It has to do with the connection library you use. For most libraries, the user name is enough. But for some libraries (subject to change so I don&amp;rsquo;t list them here) the server name parameter isn&amp;rsquo;t sent in the way the load balancer understands, so you need to include the server name right in the login, so the system can parse it correctly. Keep in mind, the string limit for that is 128 characters &amp;ndash; so take the @ symbol and the server name into consideration for user names. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="cs_v"&gt;&lt;span class="cs_v"&gt;The user connection info is detailed here: &lt;span style="font-family:'Calibri','sans-serif';font-size:11pt;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee336268.aspx"&gt;&lt;span style="text-decoration:underline;"&gt;&lt;span style="color:#0000ff;font-family:Times New Roman;"&gt;http://msdn.microsoft.com/en-us/library/ee336268.aspx&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="cs_v"&gt;&lt;span class="cs_v"&gt;Upshot? Include the @servername on your connection string just to be safe. And plan for that extra space&amp;hellip;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="cs_v"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>