简体   繁体   English

在SQL Server连接字符串中使用trusted_connection时的域注意事项

[英]Domain considerations when using trusted_connection in SQL Server connection string

I have been trying to understand what using trusted_connection=true in a SQL Server connection string (from within C#) means. 我一直试图了解在SQL Server连接字符串(从C#内部)中使用trusted_connection=true含义。 I understand that it uses the current Windows user credentials to connect to the database. 我了解它使用当前的Windows用户凭据连接到数据库。 But does it mean the database server and the current user can be in different domains, same domain or in different but trusted domains ? 但这是否意味着数据库服务器和当前用户可以位于不同的域,相同的域或不同但受信任的域中?

trusted_connection=true means Integrated Security=SSPI; trusted_connection=true表示Integrated Security=SSPI;

If this is not present in connection string then you need to specify userid and password in connection string as: 如果连接字符串中不存在此字符,则需要在连接字符串中将用户名和密码指定为:

server=yourservername;database=yourdatabase;user id=YourUserID;password=password

If any of two ( Trusted_Connection=true or Integrated Security=true/SSPI ) is present , then the Windows credentials of the current user are used to authenticate against SQL Server and any useriD=userid and password=password text will be ignored. 如果存在两个( Trusted_Connection=true or Integrated Security=true/SSPI )中的任何一个,则使用当前用户的Windows credentialsSQL Server进行身份验证,并且将忽略任何useriD = userid和password = password文本。

Whichever number of users may present and fromwhichever user you may have logged in, it will ignore the stuff if: 无论出现的用户数量是多少,以及您已经登录的用户数量,在以下情况下,它将忽略该内容:

Trusted_Connection=true 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM