"Server" vs "Data Source" in connection string

Sql ServerConnection StringSqldatasourceLocaldb

Sql Server Problem Overview


I'm new to SqlServer, right now I have SqlLocalDb installed to work locally. Good, but I can see two connection strings typically and both works:

Data Source=(localdb)\v11.0;Integrated Security=true;

and

Server=(localdb)\v11.0;Integrated Security=true;

What exact difference is there between the two?

Sql Server Solutions


Solution 1 - Sql Server

For the full list of all of the connection string keywords, including those that are entirely synonymous, please refer to the SqlConnection.ConnectionString documentation:

These are all entirely equivalent:

> * Data Source > * Server > * Address > * Addr > * Network Address

Solution 2 - Sql Server

> ... There is no difference between Server and Data Source as they represent the same thing for SQL Server : the full name of the SQL Server instance with the syntax "MyComputerName\MyShortInstanceName" , potentially including the port used by the SQL Server instance to communicate.

Reference: http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/7e3cd9b2-4eed-4103-a07a-5ca2cd33bd21

Solution 3 - Sql Server

They are synonymous - you can use either one.

That is - as far as the framework is concerned, they are the same.

Solution 4 - Sql Server

My favorite set up is one that doesn't contain any spaces. In the simplest form, one has to provide four values - the URL, the container, the user and the credential.

  • server
  • database
  • uid
  • pwd

So a connection string looks like this.

> server=stuffy.databases.net;database=stuffy;uid=konrad;pwd=Abc123(!);

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionnawfalView Question on Stackoverflow
Solution 1 - Sql ServerDamien_The_UnbelieverView Answer on Stackoverflow
Solution 2 - Sql ServerExel GamboaView Answer on Stackoverflow
Solution 3 - Sql ServerOdedView Answer on Stackoverflow
Solution 4 - Sql ServerKonrad VilterstenView Answer on Stackoverflow