What is the difference between Integrated Security = True and Integrated Security = SSPI?
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
.
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)
Using Windows Authentication
To connect to the database server is recommended to use Windows Authentication, commonly known as integrated security. To specify the Windows authentication, you can use any of the following two key-value pairs with the data provider. NET Framework for SQL Server:
Integrated Security = true;
Integrated Security = SSPI;
However, only the second works with the data provider .NET Framework OleDb. If you set Integrated Security = true
for ConnectionString an exception is thrown.
To specify the Windows authentication in the data provider. NET Framework for ODBC, you should use the following key-value pair.
Trusted_Connection = yes;
Source: MSDN: Working with Connection Strings