Microsoft SQL Server connection strings

Some useful links:
Microsoft tool for creating connection strings
An online tool for creating connection strings (www.aireforge.com)

A connection string is a text string that specifies the parameters needed to access to the Microsoft SQL server database. The following examples show connection strings for the most common configurations:

Standard Security

Data Source=1.1.1.1;Database=example_database;Integrated Security=false;User ID=MyUsername;Password=123456;
Remarks:
  • Use serverName\instanceName as Data Source to connect to a specific SQL Server instance.
  • If you are using SQL Server Express don’t miss the server name syntax Servername\SQLEXPRESS where you substitute Servername with the name of the computer where the SQL Server Express installation resides.

Standard Security alternative syntax

This connection string produces the same result as the previous one. It is included here to point out that some connection string keywords have many equivalents.

Data Source=1.1.1.1;Database=example_database;Integrated Security=false;User ID=MyUsername;Password=123456;

Trusted Connection

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

Trusted Connection alternative syntax

This connection string produces the same result as the previous one. It is included here to point out that some connection string keywords have many equivalents.

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

Connecting to an SQL Server instance

The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.

Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=True;

© 2008-2024 Triple Click Software
News & Updates

Privacy Policy & Terms of Use
PAD file·Old news