🔎SQL Server 無法連線?完整解決「Connection timed out」教學
SQL Server 無法連線?完整解決「Connection timed out」教學 在使用 TIBCO、Spotfire 或其他工具連接 SQL Server 時,很多人會遇到以下錯誤: Could not establish contact with the database: [tibcosoftwareinc][SQLServer JDBC Driver] Error establishing socket to host and port: 220.133.47.3:1433. Reason: Connection timed out: connect 這段訊息其實代表 資料庫連線逾時 ,意思是:電腦試著打開一個「通道」連到 SQL Server,但等不到回應,就像打電話卻沒人接聽。下面我會用「軟體工程師」的角度,帶你一步步找出問題。 為什麼會出現 Connection timed out? 最常見的原因有: SQL Server 沒有啟用 TCP/IP 連線 資料庫沒有在 1433 埠 上監聽 防火牆阻擋了 SQL 連線 網路路由或 ISP 攔截封包 資料庫在內網,外部沒有設定 Port Forward 使用命名實例但連線字串錯誤 如何逐步檢查? 1. 測試本機是否能連上伺服器 在 Windows PowerShell 輸入: Test-NetConnection 220.133.47.3 -Port 1433 如果顯示 TcpTestSucceeded : True → 網路可達,問題可能在資料庫設定。 如果顯示 False → 網路被擋或伺服器沒有開放。 2. 檢查 SQL Server 設定 打開 SQL Server Configuration Manager 確認 TCP/IP 協定有啟用 檢查 IPAll → TCP Port 是否為 1433 在伺服器命令列輸入: netstat -ano | findstr :1433 確認有顯示 LISTENING 3. 防火牆與安全性設定 Windows 防火牆 → 建立「入站規則」,允許 TCP 1433...