诊断与 SQL Server 的连接

2022-01-24 00:00:00 connection odbc sql-server

我正在尝试创建到 SQL Server 的 ODBC 连接,但是当我这样做时,我得到了错误:

I'm trying to create an ODBC connection to SQL Server, but when i do, i get error:

Connection failed:
SQLState: '01000'
SQL Server Error: 10060
[Microsoft][ODBC_SQL Server Driver][TCP/IP Sockets] COnnectionOpen (Connect()).
Connection failed:
SQLState: '08001'
SQL Server Error: 17
[Microsoft][ODBC_SQL Server Driver][TCP/IP Sockets] SQL Server does not exist or access denied.

这是我尝试过的:

  1. 不是防火墙问题:尝试关闭 SQL Server 上的防火墙并关闭客户端.还可以从客户端远程登录 1433,并且工作正常.
  2. 不是访问问题:我可以使用我在客户端使用的帐户(使用 SQL Server 身份验证)从许多不同的计算机登录,包括 SQL Server 本身
  3. 我可以 ping 主机名和 IP 地址.(我都试过了)

我唯一能想到的是客户端计算机是windows server 2003,并且有各种角色设置:

The only thing i can think of is that the client computer is windows server 2003, and has various roles setup:

  • 文件服务器
  • 应用服务器
  • 终端服务器
  • 域控制器
  • DNS 服务器

我不知道为什么要设置这些服务,但目前我无法关闭它们.会不会是其中的任何一个,如果是这样,有没有办法禁用它们的任何方面,这可能会阻塞 SQL.

I don't know why these services are setup, but for the time being i can't shut them off. Would it be any of these, and if so, is there a way to disable any of the aspects of them, that might be blocking SQL.

任何建议都非常感谢!

推荐答案

发现问题.出于某种原因,即使客户端上没有使用 SQL,它也已安装,并且通过转到所有程序 -> Microsoft SQL Server -> 客户端网络实用程序,我发现协议 TCP/IP 正在使用端口 4717.我不知道为什么要使用该端口,甚至更进一步,我不确定它为什么会很重要-我只是设置了一个 odbc 连接,而根本没有使用 sql server(在客户端上).不管怎样,我把它改成了典型的端口(1433),就像繁荣一样,ODBC 连接就像魅力一样!

Found the issue. For some reason, even though SQL was not in use on the client, it was installed, and by going to All Programs -> Microsoft SQL Server -> Client Network Utility, i found that the protocal TCP/IP was using port 4717. I have no idea why that port was in use, and even further, i'm not sure why it would even matter - I was just setting up an odbc connection, and not using sql server (on the client) at all. Either way, I changed this to the typical port (1433), and like boom, ODBC connection works like charm!

相关文章