What is the difference between Integrated Security = True and Integrated Security = SSPI?

后端 未结 9 2076
独厮守ぢ
独厮守ぢ 2020-11-22 10:36

I have two apps that use Integrated Security. One assigns Integrated Security = true in the connection string, and the other sets Integrated Security = S

相关标签:
9条回答
  • 2020-11-22 10:48

    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

    0 讨论(0)
  • 2020-11-22 10:49

    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

    0 讨论(0)
  • 2020-11-22 10:49

    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.

    • Data Source=.;Initial Catalog=aspnetdb;Integrated Security=True
    • Provider=SQLOLEDB;Data Source=.;Integrated Security=SSPI;Initial Catalog=aspnetdb

    When in doubt use the Visual Studio Server Explorer Data Connections.

    • What is sspi?
    • Connection Strings Syntax
    0 讨论(0)
  • 2020-11-22 10:50

    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 are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true.

    0 讨论(0)
  • 2020-11-22 10:51

    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.

    0 讨论(0)
  • 2020-11-22 10:54

    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)

    0 讨论(0)
提交回复
热议问题