我如何使用ip地址连接SQL服务器? [英] How I connect with SQL server using ip address ?

查看:134
本文介绍了我如何使用ip地址连接SQL服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写这个连接: -

SqlConnection con = new SqlConnection(Data Source = 190.190.200.100,1433; Initial Catalog = WhiteWhaleDB; Network Library = DBMSSOCN; Connect Timeout = 30; User ID ='saa';密码='123456789';);





我将Ip1中的ipaddress更改为190.190.200.100但是我无法更改启用从否。是



但我有错误:-(建立与SQL Server的连接时发生网络相关或特定于实例的错误。找不到服务器或无法访问服务器。验证实例名称是否正确以及SQL Server是否配置为允许远程连接。(提供程序:TCP提供程序,错误:0 - 等待操作超时。)



我尝试了什么:



只是我想用sql连接程序来自另一台电脑和主电脑的服务器。

i write this connection :-
SqlConnection con = new SqlConnection("Data Source=190.190.200.100,1433;Initial Catalog=WhiteWhaleDB;Network Library=DBMSSOCN;Connect Timeout=30;User ID='saa';Password='123456789';");


and i change ipaddress in Ip1 to 190.190.200.100 but i cant change enable from no to yes.

but i have error :-(A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.))

What I have tried:

just i want do that to connect the program with sql server from another pc and the main pc too .

推荐答案

几件事要检查:



    验证是否已启用TCP / IP。您可以使用SQL Server配置管理器执行此操作
  • 在配置管理器中,如果全部监听设置为是,则单个IP地址已启用否但活动应为是
  • 进行更改后记得重新启动SQL Server
  • 检查端口。使用SQL Server配置管理器或您可以从errorlog -file检查端口。搜索侦听文本
  • 确保防火墙未阻止对话。无论使用什么端口,都应该允许在防火墙中使用。
Few things to check:

  • Verify that TCP/IP is enabled. You can do that with SQL Server configuration manager
  • In configuration manager if "Listen All" is set to Yes, individual IP addresses have Enabled "No" but active should be "Yes"
  • After making changes remember to restart SQL Server
  • Check the port. Either use SQL Server configuration manager or you can check the port from errorlog -file. Search for text "listening"
  • Ensure that firewall is not blocking the conversation. Whatever is the port used, it should be allowed in firewall.


这篇关于我如何使用ip地址连接SQL服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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