简体   繁体   English

使用Windows身份验证连接到不同域上的SQL Server

[英]Connecting to SQL Server on different domain using Windows Authentication

I am trying to connect to a SQL Server that is located on a different domain and does not have SQL Server authentication enabled. 我试图连接到位于其他域上且未启用SQL Server身份验证的SQL Server。 I am using this connection string but it doesn't work. 我正在使用此连接字符串,但不起作用。

Data Source=<Server\Instance>;User ID=<domain\username>;password=<password>;connection timeout=10

If the domains are joined together in some way (part of the same forest, domain trusts, forest trusts etc.), you should be able to grant the domain user you're running as permissions on the database. 如果将域以某种方式连接在一起(属于同一林,域信任,林信任等),则您应该能够将正在运行的域用户授予数据库权限。

Alternatively, you could run the connection in the security context of an authorised domain user by using impersonation. 或者,您可以使用模拟在授权域用户的安全上下文中运行连接。 This would rely on that user having the correct permissions to log into the machine your code is running on. 这将取决于该用户是否具有正确的权限才能登录到您正在运行代码的计算机。

If there is no trust between the domains then you are going to have to go with SQL Auth as I don't believe that it is possible to impersonate a domain user from a non-trusted computer. 如果域之间不信任,那么您将不得不使用SQL Auth,因为我不认为可以从不受信任的计算机上模拟域用户。

If you aren't able to enable SQL auth then I don't think you'll be able to do what you ask. 如果您无法启用SQL身份验证,那么我认为您将无法执行您要求的操作。

暂无
暂无

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

相关问题 使用 Windows 身份验证连接到 SQL Server - Connecting to SQL Server using windows authentication 使用Windows身份验证模式连接到VM上的SQL Server实例 - Connecting to a SQL Server instance on a VM using Windows Authentication mode 使用Windows身份验证将SQL Server与ASP.NET连接 - Connecting SQL Server with ASP.NET using Windows Authentication Windows应用程序(使用SQL Server)需要在其他域的PC上运行 - windows app, using SQL Server, need to it work on PCs on a different domain 使用Windows身份验证连接到不同域上的不同数据库 - Connecting to different databases on different domains using Windows Authentication 使用Windows身份验证从非域计算机访问SQL Server 2005 - Access to SQL Server 2005 from a non-domain machine using Windows authentication 我想使用Windows身份验证连接到另一个域上的SQL Server,而域之间不信任 - I want to connect to a SQL server on another domain using Windows authentication while there is no trust between domains 使用C#使用具有不同凭据的Windows身份验证连接到数据库 - Connecting To A Database Using Windows Authentication With Different Credentials using C# 通过Windows远程桌面连接到SQL数据库:该登录名来自不受信任的域,不能与Windows身份验证一起使用 - Connecting to SQL database over Windows Remote Desktop: The Login is from an untrusted domain and cannot be used with WIndows Authentication 使用 Exchange Web 服务和 windows 身份验证连接到 Exchange Server - Connecting to an Exchange Server using exchange webservice and windows authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM