Connection Strings

As we all know, a connection sting is the mechanism we use to tell ADO.NET about where our data source resides and various parameters that should be used when accessing that data source. A connection string typically contains these pieces of information:

    • The name of the server that is running our database server software.

    • The name of the database on that database server to which we wish to “connect.”

    • The credentials (login name and password) that should be used to authorize our access to the database.

    • The number of seconds to wait for a connection to the database to be established before timing out.

A connection string can contain much more information, but bear in mind that even this minimal information requires a string of at least 50–100 characters. Here’s a typical example:

Data Source=my-database-server;Initial Catalog=my-database-name;User Id=user-name;Password=******;Connect Timeout=5

Quite a few characters to specify the location of a database...