<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>Understanding “Data Source=(local)” in SQL Server Connection Strings</title><link>http://blogs.msdn.com/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx</link><description>Lately we have noticed many misunderstandings surrounding the usage of the Data Source keyword in connection strings, caused by people generalizing from an example demonstrating a connection string for local connectivity and creating their own connection</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Understanding “Data Source=(local)” in SQL Server Connection Strings</title><link>http://blogs.msdn.com/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx#8962333</link><pubDate>Tue, 23 Sep 2008 18:03:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8962333</guid><dc:creator>Soczo Zsolt</dc:creator><description>&lt;p&gt;And what's the difference between (local), ., localhost and machine name?&lt;/p&gt;
&lt;p&gt;Are they use the same protocol, or (local) and . use shared memory and localhost and machine name use tcp/ip?&lt;/p&gt;
</description></item><item><title>re: Understanding “Data Source=(local)” in SQL Server Connection Strings</title><link>http://blogs.msdn.com/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx#8962948</link><pubDate>Wed, 24 Sep 2008 04:12:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8962948</guid><dc:creator>SQL Protocols</dc:creator><description>&lt;p&gt;For clients shipped with SQL Server 2005 and beyond, all of (local), ., and localhost are equivalent and are not tied to any particular protocol. &amp;nbsp;You can verify this for yourself pretty easily if you have a local SQL Server 2005 instance with both TCP and Shared Memory enabled:&lt;/p&gt;
&lt;p&gt;C:\&amp;gt;osql -E -Stcp:(local)&lt;/p&gt;
&lt;p&gt;1&amp;gt; select net_transport from sys.dm_exec_connections where session_id = @@SPID&lt;/p&gt;
&lt;p&gt;2&amp;gt; go&lt;/p&gt;
&lt;p&gt; net_transport&lt;/p&gt;
&lt;p&gt; ----------------------------------------&lt;/p&gt;
&lt;p&gt; TCP&lt;/p&gt;
&lt;p&gt;C:\&amp;gt;osql -E -Slocalhost&lt;/p&gt;
&lt;p&gt;1&amp;gt; select net_transport from sys.dm_exec_connections where session_id = @@SPID&lt;/p&gt;
&lt;p&gt;2&amp;gt; go&lt;/p&gt;
&lt;p&gt; net_transport&lt;/p&gt;
&lt;p&gt; ----------------------------------------&lt;/p&gt;
&lt;p&gt; Shared memory&lt;/p&gt;
&lt;p&gt;Machine name is slightly different from those, since depending on the network transport protocol, we may have to do a DNS lookup to resolve it to an IP Address. &amp;nbsp;You can still get shared memory from using the local machine name, though:&lt;/p&gt;
&lt;p&gt;C:\&amp;gt;osql -E -SLocalMachineName&lt;/p&gt;
&lt;p&gt;1&amp;gt; select net_transport from sys.dm_exec_connections where session_id = @@SPID&lt;/p&gt;
&lt;p&gt;2&amp;gt; go&lt;/p&gt;
&lt;p&gt; net_transport&lt;/p&gt;
&lt;p&gt; ----------------------------------------&lt;/p&gt;
&lt;p&gt; Shared memory&lt;/p&gt;
</description></item><item><title>rerro</title><link>http://blogs.msdn.com/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx#9270315</link><pubDate>Sat, 03 Jan 2009 16:10:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9270315</guid><dc:creator>Md.Meraj</dc:creator><description>&lt;p&gt;Unable To Connect Remote Connection when my asp.net website hosting after that when user logining then it will pass the error message.&lt;/p&gt;
&lt;p&gt;Code Behind---------&lt;/p&gt;
&lt;p&gt; &amp;nbsp;SqlConnection con = new SqlConnection();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; // con.ConnectionString = &amp;quot;Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\SiliguriNeuro.mdf;Integrated Security=True;User Instance=True&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.ConnectionString = &amp;quot;Data Source=.\\SQLEXPRESS,1433;AttachDbFilename=|DataDirectory|\\SiliguriNeuro.mdf;Initial Catalog=SiliguriNeuro;Integrated Security=SSPI;User ID=nrhalder;Password=12345678;&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp;con.ConnectionString = &amp;quot;Data Source={0};User ID={1};Password={2}&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;con.Open();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string UserName = TextBox1.Text;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string Password = TextBox2.Text;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp;Class1.UserType = TextBox1.Text;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; // &amp;nbsp; Class2.UserId = UserName.ToString();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlDataReader dr;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string str = &amp;quot;select * from Login where UserName='&amp;quot; + UserName + &amp;quot;' and Password='&amp;quot; + Password + &amp;quot;'&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlCommand cmd = new SqlCommand(str, con);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dr = cmd.ExecuteReader();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (dr.HasRows)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Server.Transfer(&amp;quot;PatientDetails.aspx&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Label6.Text = &amp;quot;You are not a Valid User&amp;quot;;&lt;/p&gt;
&lt;p&gt;please help me&lt;/p&gt;
</description></item><item><title>re: Understanding “Data Source=(local)” in SQL Server Connection Strings</title><link>http://blogs.msdn.com/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx#9302584</link><pubDate>Fri, 09 Jan 2009 23:35:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9302584</guid><dc:creator>Sam</dc:creator><description>&lt;p&gt;I've got a 2 node 2005 cluster. &amp;nbsp;Is there a way to make local work on it. &amp;nbsp;I'm assuming it's trying to connect to the local default instance on the machine, which would be myclusterNode1 - obviously not going to work, as it needs to be going to the virtual SQL name.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Sam &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Understanding “Data Source=(local)” in SQL Server Connection Strings</title><link>http://blogs.msdn.com/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx#9319131</link><pubDate>Wed, 14 Jan 2009 21:07:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9319131</guid><dc:creator>SQL Protocols</dc:creator><description>&lt;p&gt;Sam,&lt;/p&gt;
&lt;p&gt;When connecting to cluster instances, you cannot use (local) and must use the virtual server name, please refer to my other blog for details: &lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/sql_protocols/archive/2005/12/05/500013.aspx"&gt;http://blogs.msdn.com/sql_protocols/archive/2005/12/05/500013.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Xinwei&lt;/p&gt;
</description></item><item><title>re: Understanding “Data Source=(local)” in SQL Server Connection Strings</title><link>http://blogs.msdn.com/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx#9832606</link><pubDate>Tue, 14 Jul 2009 03:52:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9832606</guid><dc:creator>csjones</dc:creator><description>&lt;p&gt;Great blogs! Keep up the good work :)&lt;/p&gt;
</description></item></channel></rss>