我在我的家用计算机上安装了 Microsoft SQL Server 2008 R2 Express。我的家用计算机装有 Windows 7 并且位于路由器后面。我配置了它,我认为还可以,因为我可以通过管理工作室从工作中连接到他。意味着 - 我打开了所有必要的端口,我配置了 SQL 来接受 TCP 上的连接。我还在我的路由器上设置了 DynDNS,并通过我的 DNS 名称进行连接并且它可以工作。
我还使用 Microsoft PortQueryUI [ http://www.microsoft.com/download/en/details.aspx?id=24009 ] 来测试服务器是否可见,并且在我的工作计算机上是否可见。我在工作中的 PortQueryUI 输出正常(附上),但来自其他网络的人无法连接到我的服务器。他们在端口 1434 UDP(大粗体)的测试中出现错误代码 0x00000002,而我的错误代码是正确的 - 0x00000000。
这是什么原因,是否需要在他们的计算机上执行某些操作?也许他们的网络阻止了某些东西?
我的 PortQueryUI 工作输出:
=============================================
Starting portqry.exe -n myhome.dyndns.net -e 1434 -p UDP ...
Querying target system called:
myhome.dyndns.net
Attempting to resolve name to IP address...
Name resolved to 83.xxx.xxx.xxx
querying...
UDP port 1434 (ms-sql-m service): LISTENING or FILTERED
Sending SQL Server query to UDP port 1434...
Server's response:
ServerName ROBERT-KOMPUTER
InstanceName SQL2008R2
IsClustered No
Version 10.50.1600.1
tcp 1433
np \\ROBERT-KOMPUTER\pipe\MSSQL$SQL2008R2\sql\query
==== End of SQL Server query response ====
UDP port 1434 is LISTENING
portqry.exe -n myhome.dyndns.net -e 1434 -p UDP exits with return code 0x00000000.
=============================================
Starting portqry.exe -n myhome.dyndns.net -e 1433 -p TCP ...
Querying target system called:
myhome.dyndns.net
Attempting to resolve name to IP address...
Name resolved to 83.xxx.xxx.xxx
querying...
TCP port 1433 (ms-sql-s service): LISTENING
portqry.exe -n myhome.dyndns.net -e 1433 -p TCP exits with return code 0x00000000.
i have set up a Microsoft SQL Server 2008 R2 Express on my home computer. My home computer has Windows 7 and is behind a router. I configured it i think ok, because i can connect to him from work through management studio. Means - i opened all necessary ports, i configured SQL to accept connections on TCP. I have also on my router set up DynDNS and i connect through my DNS name and it works.
I use also Microsoft PortQueryUI [ http://www.microsoft.com/download/en/details.aspx?id=24009 ] to test if the server is visible and from my work computer and it is visible. My PortQueryUI output at work is ok (attached bloew) but people from other networks cannot connect to my server.They have in the test to port 1434 UDP (big bold) an error code 0x00000002 where i have it correct - 0x00000000.
What is the reason, is there something that needs to be done on their computers? Maybe their network is blocking something?
My PortQueryUI output from work:
=============================================
Starting portqry.exe -n myhome.dyndns.net -e 1434 -p UDP ...
Querying target system called:
myhome.dyndns.net
Attempting to resolve name to IP address...
Name resolved to 83.xxx.xxx.xxx
querying...
UDP port 1434 (ms-sql-m service): LISTENING or FILTERED
Sending SQL Server query to UDP port 1434...
Server's response:
ServerName ROBERT-KOMPUTER
InstanceName SQL2008R2
IsClustered No
Version 10.50.1600.1
tcp 1433
np \\ROBERT-KOMPUTER\pipe\MSSQL$SQL2008R2\sql\query
==== End of SQL Server query response ====
UDP port 1434 is LISTENING
portqry.exe -n myhome.dyndns.net -e 1434 -p UDP exits with return code 0x00000000.
=============================================
Starting portqry.exe -n myhome.dyndns.net -e 1433 -p TCP ...
Querying target system called:
myhome.dyndns.net
Attempting to resolve name to IP address...
Name resolved to 83.xxx.xxx.xxx
querying...
TCP port 1433 (ms-sql-s service): LISTENING
portqry.exe -n myhome.dyndns.net -e 1433 -p TCP exits with return code 0x00000000.
发布评论
评论(3)
确保 SQL 所在的防火墙上的端口 1433 已打开,为了安全起见,您也应该在其上放置某种 IP 范围/范围。
您需要在数据库属性中将数据库设置为
接受远程连接
。您需要设置用户名和密码并授予其访问数据库的权限,以便您的远程连接能够识别它。
以下是允许连接的示例:
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
以下是连接示例:
http://www.youtube.com/watch?v=hT9p_FPt720
Make sure port 1433 is open on your firewall where SQL is, you should probably put some sort of IP range/scope on that too for security.
You need to set your database to
Accept Remote Connections
in the DB properties.You need to setup a username and password and give it access to the database so your remote connection recognizes it.
Here's an example of allowing the connection:
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
Here's an example of connecting:
http://www.youtube.com/watch?v=hT9p_FPt720
我遇到了同样的问题,但我已经在防火墙上设置了 1433 上的开放端口。对我来说,SQL 2012 的解决方案很简单:
I had the same problem but I had already setup open ports on 1433 on the firewall. The solution for me was simple on SQL 2012:
我有一个非默认命名实例。因此,我必须在 services.msc 上启用并启动 SQL Server Browser 服务
。请务必检查下面 Microsoft 的故障排除:
https://learn.microsoft.com/en-us/archive/blogs/sql_protocols/steps-to-troubleshoot-sql-connectivity-issues
I have a non-default named instance. So I`ve had to enable and start the SQL Server Browser service on services.msc
Make sure to check Microsoft's troubleshooting below:
https://learn.microsoft.com/en-us/archive/blogs/sql_protocols/steps-to-troubleshoot-sql-connectivity-issues