2013-12-14 194 views
0

我想通過JDBC驅動程序連接到SQL Server,但不斷收到此錯誤:連接到SQL Server使用JDBC錯誤

Error connecting to the specified data source: 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.".

我的連接字符串是:

jdbc:sqlserver://localhost\SRVR_SQL:1433;DatabaseName=spotfire_server  

我也試過這樣:

jdbc:sqlserver://10.10.60.12\SRVR_SQL:1433;DatabaseName=spotfire_server  

這:

jdbc:sqlserver://localhost:1433;DatabaseName=spotfire_server 

這:

jdbc:sqlserver://SRVR_SQL:1433;DatabaseName=spotfire_server 

但他們都給出了同樣的錯誤

+0

可能重複失敗,錯誤:TCP/IP連接到主機失敗](http://stackoverflow.com/questions/18841744/jdbc-connection-failed-error-tcp-ip-connection-to-host-failed) – duffymo

回答

0

嘗試10.0.0.2 確保像數據庫密碼,姓名,表名基本的東西.... 。

0

讀取錯誤:

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.

確定SQL Server在本地運行?你能通過SQL Server管理工具連接到它嗎?

您正在使用哪種JDBC驅動程序 - Microsoft或jDTS?

試試這個URL,假設監聽器上運行10.10.60.12,端口爲1433,並且架構名稱是DBNAME:

jdbc:sqlserver://10.10.60.12:1433;DatabaseName=dbName 
[JDBC連接
+0

我可以通過SSMS連接到它,我正在使用微軟的JDBC驅動程序...我試着你上面提到的,但仍然得到相同的錯誤 – user2061886