从另一台计算机连接到SQL Server [英] Connecting to SQL server from another computer

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

问题描述

我正在使用c#连接到网络上另一台计算机上的sql server,但出现异常消息,用户 username的登录失败,但是服务器日志状态表明使用Windows身份验证$ b $的用户连接成功b我的连接字符串是:

I am using c# to connect to sql server on another computer on the network but i got an exception message Login failed for user ' username' however the server log state that the connection is successful for the user using windows authentication my connection string is:

"Data Source=ipaddress,1433;Initial Catalog=database;Trusted_Connection=True;Integrated Security=False;Connect Timeout=30;user ID=username;password=password"

我正在使用Microsoft sql服务器2008 R2

I am using microsoft sql server 2008 R2

预先感谢

推荐答案

您应该检查:


  1. 删除 Trusted_Connection = True;在您的连接字符串中

  1. Remove "Trusted_Connection=True;" in your connection string

关闭两台计算机上的防火墙以进行测试。如果可行,则可以同时启用这两个功能,然后为特定应用程序配置访问权限

Turn off the firewall on both machines for testing. If it works, you can enable the both of them and then configure the access rights for specific application

在SQL Server实例上启用SQL身份验证: http://kbase.gfi.com/showarticle.asp?id=KBID002804

Enable SQL Authentication on SQL Server instance: http://kbase.gfi.com/showarticle.asp?id=KBID002804

无需运行c#代码即可测试其是否有效的简单方法:您可以在代码机上安装SQL Management Studio,然后尝试连接SQL Server实例。 / p>

Simple way to test it works or not without running your c# code: you can install the SQL Management Studio on the code-machine and try to connect the SQL Server instance.

希望它会有所帮助。

这篇关于从另一台计算机连接到SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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