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?
They are synonymous - you can use either one. That is - as far as the framework is concerned, they are the same. I've been googlearching for the reason for the range of equivalent keywords in the connection strings.
A data source connection specifies the parameters needed to connect to a database, such as the location of the database and the timeout duration. These parameters form a connection string for the data source. You can include authentication information for the database in the data source connection by creating a signon.
The connection string is an expression that contains the parameters required for the applications to connect a database server. In terms of SQL Server, connection strings include the server instance, database name, authentication details, and some other settings to communicate with the database server.
Data source is the name of the MS SQL server instance you are connecting to and Inital Catalog is the database name you want to connect to. EG: You have a default instance of MS SQL server Express and a database named Northwind.
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
... 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With