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
Integrated Security = True
orSSPI
are not same.Integrated Security=true;
doesn't work in all SQL providers, it throws an exception when used with theOleDb
provider. So basicallyIntegrated Security=SSPI;
is preferred since works with bothSQLClient
&OleDB
provider. I have added an answer for better clarification. – Pranav Singh