C# Sql 连接字符串中的 Trusted = yes/no 是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1242993/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 14:07:24  来源:igfitidea点击:

What does Trusted = yes/no mean in Sql connection string?

c#sql-server-2005ado.net

提问by Ashish Ashu

What does Trusted = yes/no mean in Sql connection string?

Sql 连接字符串中的 Trusted = yes/no 是什么意思?

I am creating a connection string as below :

我正在创建一个连接字符串,如下所示:

            string con= string.Format(
                "user id=admin;password=admin;server={0};Trusted_Connection=yes;database=dbtest;connection timeout=600",
                _sqlServer);

Please Help

请帮忙

采纳答案by Arsen Mkrtchyan

Integrated Securityor Trusted_Connection

Integrated Security或者 Trusted_Connection

When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication.

当 时false,在连接中指定了用户 ID 和密码。当 时true,当前的 Windows 帐户凭据用于身份验证。

Recognized values are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true.

识别的值为true、false、yes、no和sspi(强烈推荐),相当于true。

回答by Jay Riggs

Check out connectionstring,comfor detailed description of all the various SQL Server connecion string properties. Specifically, this article:

查看connectionstring,com以获取所有各种 SQL Server 连接字符串属性的详细说明。具体来说,这篇文章

回答by sadiq

SSPI stands for Security Support Provider Interface.

SSPI 代表安全支持提供程序接口。

The SSPI allows an application to use any of the available security packages on a system without changing the interface to use security services. The SSPI does not establish logon credentials because that is generally a privileged operation handled by the operating system.

SSPI 允许应用程序使用系统上任何可用的安全包,而无需更改接口以使用安全服务。SSPI 不建立登录凭据,因为这通常是由操作系统处理的特权操作。

Usually a .NETconnection string looks like this, of course you will have your own server, database names.

通常一个 .NETconnection 字符串看起来像这样,当然你会有自己的服务器,数据库名称。

"Data Source=localhost\sql2012;Initial Catalog=AdventureWorks; Integrated Security=SSPI"

"Data Source=localhost\sql2012;Initial Catalog=AdventureWorks; Integrated Security=SSPI"

Other than SSPIyou can also use "true".

除了SSPI你还可以使用"true".

Integrated Security actually ensures that you are connecting with SQL Server using Windows Authentication, not SQL Authentication; which requires username and password to be provided with the connecting string.

集成安全实际上确保您使用 Windows 身份验证而不是 SQL 身份验证与 SQL Server 连接;这需要用户名和密码与连接字符串一起提供。