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