JDBC 连Sql Server 接数据库--The TCP/IP connection to the host localhost, port 1433 has failed


原文:https://blog.csdn.net/qq_39241986/article/details/80848855

 

这样的错误,你有遇到过吗?

The TCP/IP connection to the host localhost, port 1433 has failed.
  • 1

这里写图片描述

com.microsoft.sqlserver.jdbc.SQLServerException: 
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. 
Verify the connection properties.
Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
  • 1
  • 2
  • 3
  • 4
  • 5

解决方法:

1.选中此电脑–>右键管理–>计算机管理–>服务和应用程序 
   (1)先查看 sql server 服务是否已经开启 
到–>SQL Server 配置管理器–>SQL Server 服务,确保本地Sql Server 服务已经开启。 
这里写图片描述 
   (2)再查看 sql server 网络配置 
到–>SQL Server 配置管理器–>SQL Server 网络配置,确保Named PipesTCP/IP 协议为已启用状态。 
这里写图片描述 
2.我们再次运行程序,可能会出现还是连接不成功的现象,继续解决问题: 
   还是看 sql server 网络配置 
到–>SQL Server 配置管理器–>SQL Server 网络配置,Named PipesTCP/IP 协议为已启用状态,选中TCP/IP右键–>属性–>IP地址,往下拉滚动条,查看IPALLTCP端口是否为1433,不是,则改为1433。 
这里写图片描述 
最后,重启SQL Server服务,然后再运行程序,成功,舒服啦 ! 
这里写图片描述


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 Druid连接SQL Server报错:The TCP IP connection to the host 127.0.0.1, port 1433 has failed. 开个玩笑:The TCP/IP connection to the host XXXX, port 1433 has failed. JDBC连接SQL Server数据库出现“通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败”错误解决办法 帆软FineReport连接SQL Server数据库不成功:通过端口1433连接到主机localhost的 TCP/IP 连接失败 postgresql connection failure:SQLSTATE[08006] [7] could not connect to server: Permission denied Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? 通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败。错误:“Connection refused: connect。 MySql数据库:Host 'localhost' is not allowed to connect to this MySQL server java连接sql server报错:com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性,并检查 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到 com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 127.0.0.1 的 TCP/IP 连接失败。错误:“Connection refused: connect。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。” com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 127.0.0.1 的 TCP/IP 连接失败。错误:“Connection refused: connect。请验证连接属性,并检查 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM