非域计算机连接到域的SQL Server 2005 [英] Connect to domain SQL Server 2005 from non-domain machine

查看:311
本文介绍了非域计算机连接到域的SQL Server 2005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我前几天问了一个问题(<一href="http://stackoverflow.com/questions/2795723/access-to-sql-server-2005-from-a-non-domain-machine-using-windows-authentication">http://stackoverflow.com/questions/2795723/access-to-sql-server-2005-from-a-non-domain-machine-using-windows-authentication)这得到了一些有趣的,但不能使用建议,我想问的问题了,但明确什么我约束是:

I asked a question a few days ago (http://stackoverflow.com/questions/2795723/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:

我在其中一台机器运行SQL Server 2005和它被配置为只支持Windows身份验证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.

我知道我可以写只用这四个参数,Perl和Java应用程序可以连接到SQL Server数据库:服务器名称,数据库名称,用户名(在窗体域\用户)和密码

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 domain\user), and password.

在C#中我尝试了各种乾坤:

In C# I have tried various things around:

string connectionString = "Data Source=server;Initial Catalog=database;User Id=domain\user;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#?

感谢您的帮助,马丁

推荐答案

正如你说得很对,JDBC或Perl在Linux机器上既可以连接到SQL服务器使用Windows身份验证和凭证而不同从当前登录的用户。 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驱动程序的问题。我想上面提到的pretend要使用一些特定的凭证在Windows计算机在网络层面的方法;一个功能,它在SQL Server OLE DB驱动程序缺乏。因此,我的建议是寻找替代(也许商业的?)OLE DB驱动程序可以访问SQL Server数据库。我不知道,如果这样的事情存在,但。

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆