Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Initial Catalog and Database keyword in connection string

Tags:

ado.net

What is the main difference between Initial Catalog and Database Keyword in a connection string?

like image 942
ravi Avatar asked Sep 02 '12 18:09

ravi


People also ask

What does initial catalog mean in connection string?

Initial Catalog is the name of the database to be used by the connection string, which is located on the server that was specified in the Data Source part of the connection string.

What is database name in connection string?

Database name is a value of SqlConnectionStringBuilder. InitialCatalog property.

What are the different parts of a connection string?

A connection string provides the information that a provider needs to communicate with a particular database. The Connection String includes parameters such as the name of the driver, Server name and Database name , as well as security information such as user name and password.

What is the difference between data source and server in connection string?

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.


1 Answers

The only difference is the name.

These can be used interchangeably.

See the documentation of SqlConnectionStringBuilder.InitialCatalog, under remarks:

This property corresponds to the "Initial Catalog" and "database" keys within the connection string.

(emphasis mine)

like image 117
Oded Avatar answered Sep 28 '22 03:09

Oded