I have two apps that use Integrated Security. One assigns Integrated Security = true
in the connection string, and the other sets Integrated Security = S
Let me start with Integrated Security = false
false
User ID and Password are specified in the connection string.
true
Windows account credentials are used for authentication.
Recognized values are true
, false
, yes
, no
, and SSPI
.
If User ID
and Password
are specified and Integrated Security is set to true
, then User ID
and Password
will be ignored and Integrated Security will be used
Integrated Security = False : User ID and Password are specified in the connection. Integrated Security = true : the current Windows account credentials are used for authentication.
Integrated Security = SSPI : this is equivalant to true.
We can avoid the username and password attributes from the connection string and use the Integrated Security
Note that connection strings are specific to what and how you are connecting to data. These are connecting to the same database but the first is using .NET Framework Data Provider for SQL Server. Integrated Security=True will not work for OleDb.
When in doubt use the Visual Studio Server Explorer Data Connections.
According to Microsoft they are the same thing.
When
false
, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication.
Recognized values aretrue
,false
,yes
,no
, andsspi
(strongly recommended), which is equivalent totrue
.
True is only valid if you're using the .NET SqlClient library. It isn't valid when using OLEDB. Where SSPI is bvaid in both either you are using .net SqlClient library or OLEDB.
Integrated Security=true;
doesn't work in all SQL providers, it throws an exception when used with the OleDb
provider.
So basically Integrated Security=SSPI;
is preferred since works with both SQLClient
& OleDB
provider.
Here's the full set of syntaxes according to MSDN - Connection String Syntax (ADO.NET)