从非域机器连接到域 SQL Server 2005

Connect to domain SQL Server 2005 from non-domain machine(从非域机器连接到域 SQL Server 2005)
本文介绍了从非域机器连接到域 SQL Server 2005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我前几天问了一个问题(从使用 Windows 身份验证的非域计算机访问 SQL Server 2005) 获得了一些有趣但不可用的建议.我想再次问这个问题,但要明确我的限制是什么:

I asked a question a few days ago (Access to SQL Server 2005 from a non-domain machine using Windows authentication) which got some interesting, but not usable suggestions. I'd like to ask the question again, but make clear what my constraints are:

我有一个 Windows 域,其中一台机器运行 SQL Server 2005,并且配置为仅支持 Windows 身份验证.我想在同一网络上但不在域上的机器上运行 C# 客户端应用程序,并访问 SQL Server 2005 实例上的数据库.

I have a Windows domain within which a machine is running SQL Server 2005 and which is configured to support only Windows authentication. I would like to run a C# client application on a machine on the same network, but which is NOT on the domain, and access a database on the SQL Server 2005 instance.

我不能在任何一台机器上创建或修改操作系统或 SQL Server 用户,我不能对权限或模拟进行任何更改,我不能使用 runas.

I CANNOT create or modify OS or SQL Server users on either machine, and I CANNOT make any changes to permissions or impersonation, and I CANNOT make use of runas.

我知道我可以编写仅使用以下四个参数即可连接到 SQL Server 数据库的 Perl 和 Java 应用程序:服务器名称、数据库名称、用户名(以域用户的形式)和密码.

I know that I can write Perl and Java applications that can connect to the SQL Server database using only these four parameters: server name, database name, username (in the form domainuser), and password.

在 C# 中,我尝试了各种方法:

In C# I have tried various things around:

string connectionString = "Data Source=server;Initial Catalog=database;User Id=domainuser;Password=password";
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();

并尝试将集成安全设置为 true 和 false,但似乎没有任何效果.我在 C# 中尝试做的事情是不可能的吗?

and tried setting integrated security to true and false, but nothing seems to work. Is what I am trying to do simply impossible in C#?

感谢您的帮助,马丁

推荐答案

正如您所说,Linux 机器上的 JDBC 或 Perl 都可以使用 Windows 身份验证和不同的凭据连接到 SQL Server来自当前登录的用户.顺便说一下,同样适用于 Windows CE 设备.

As you correctly say, JDBC or Perl on a Linux machine can both connect to an SQL Server using Windows authentication and credentials which differ from the currently logged on user. The same is true for Windows CE devices, by the way.

我认为这不是 C# 的问题,而是 SQL Server OLE DB 驱动程序的问题.我猜上面提到的方法在网络级别上假装是使用某些特定凭据的 Windows 机器";SQL Server OLE DB 驱动程序缺少的一项功能.因此,我的建议是寻找可以访问 SQL Server 数据库的替代(可能是商业的?)OLE DB 驱动程序.不过,我不确定是否存在这样的东西.

I think that this is that this is not an issue of C# but of the SQL Server OLE DB driver. I guess the methods mentioned above "pretend to be a Windows machine using some specific credentials" on the network level; a feature, which the SQL Server OLE DB driver lacks. Thus, my suggestion would be to look for an alternative (maybe commercial?) OLE DB driver that can access SQL Server databases. I'm not sure if such a thing exists, though.

这篇关于从非域机器连接到域 SQL Server 2005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to determine the type (AD User vs. AD Group) of an account?(如何确定帐户的类型(AD 用户与 AD 组)?)
How to resolve quot;The server does not support the control. The control is critical.quot; Active Directory error(如何解决“服务器不支持控件.控制至关重要.活动目录错误)
How to authenticate users with a customer#39;s (remote) active directory server(如何使用客户的(远程)活动目录服务器对用户进行身份验证)
How to know if my DirectoryEntry is really connected to my LDAP directory?(如何知道我的 DirectoryEntry 是否真的连接到我的 LDAP 目录?)
Add member to AD group from a trusted domain(将成员从受信任的域添加到 AD 组)
How to retrieve Users in a Group, including primary group users(如何检索组中的用户,包括主要组用户)