通过IP地址连接到SQL Server [英] Connect to SQL Server through IP address

查看:135
本文介绍了通过IP地址连接到SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用vb.net框架4开发工具,我需要通过IP地址连接到公司服务器,这样员工才能在家中使用这些应用程序.

I'm developing tools using vb.net framework 4, and I need to connect to company server through IP address, so staff will be able to use the apps from home.

我尝试了多种类型的连接字符串,但仍然收到此错误:

I have tried many types of connection string but I'm still getting this error:

在插入数据库中的错误建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称正确,并且已将SQL Server配置为允许远程连接. (提供者:TCP提供程序,错误:0-无法建立连接,因为目标计算机主动拒绝了该连接.)

Error in inserting to DB 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 - No connection could be made because the target machine actively refused it.)

我的连接字符串:

Data Source=xxx.xx.xxx.xxx\serverName\SQL2012,1433;Network Library=DBMSSOCN;
Initial Catalog=xxxxx;User ID=xxxxxx;Password=xxxxxxx;

推荐答案

您可以尝试以下几种方法.

Here are couple more things you can try.

检查sql server是否配置为侦听该IP地址.如果您的服务器具有多个IP地址,并不一定意味着它可以自动接受来自所有IP的连接.

Check if sql server is configured to listen on that IP address. If your server has multiple IP addresses that doesn’t necessarily mean that it can automatically accept connections from all IPs.

要进行设置,请转到SQL Server配置管理器-> SQL Server网络配置-> {instancename}的协议-> TCP/IP-> IP地址选项卡

To set this go to SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for {instancename} -> TCP/IP -> IP addresses tab

以下是设置防火墙时将指导您的一些信息. 您要对防火墙执行的操作是在端口1433上为传入和传出流量启用TCP和UDP流量.

Here is also some info that will guide you when setting up firewall. What you want to do with the firewall is to enable TCP and UDP traffic on port 1433 for both incoming and outgoing traffic.

http://www.howtogeek. com/112564/how-to-to-create-advanced-firewall-rules-in-the-windows-firewall/

现在,如果您具有物理防火墙或Windows默认以外的其他软件防火墙,则必须与网络管理员联系

Now, if you have physical firewall or some other software firewall other than windows default you’ll have to contact your network admin

这篇关于通过IP地址连接到SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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