在Sql连接字符串中Trusted = yes / no是什么意思?
在Sql连接字符串中Trusted = yes / no是什么意思?
我正在创建一个连接字符串,如下所示:
string con= string.Format( "user id=admin;password=admin;server={0};Trusted_Connection=yes;database=dbtest;connection timeout=600", _sqlServer);
请帮忙
Integrated Security
或Trusted_Connection
如果为false
,则在连接中指定用户ID和密码。 如果为true
,则使用当前Windows帐户凭据进行身份validation。
识别的值是true,false,yes,no和sspi(强烈推荐),这相当于true。
查看connectionstring,com以获取所有各种SQL Server连接字符串属性的详细说明。 具体来说, 这篇文章 :
SSPI代表安全支持提供程序接口。
SSPI允许应用程序使用系统上的任何可用安全包,而无需更改接口以使用安全服务。 SSPI不会建立登录凭据,因为这通常是操作系统处理的特权操作。
通常.NETconnection字符串看起来像这样,当然你将拥有自己的服务器,数据库名称。
"Data Source=localhost\sql2012;Initial Catalog=AdventureWorks; Integrated Security=SSPI"
除了SSPI
您还可以使用"true"
。
集成安全性实际上确保您使用Windows身份validation连接SQL Server,而不是SQL身份validation; 这需要用户名和密码来提供连接字符串。