Connection refused: connect
com.microsoft.sqlserver.jdbc.SQLServerException:
到主机的 TCP/IP 连接失败。 .ConnectException:
Connection refused: connect
at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown
Source)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown
Source)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown
Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown
Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown
Source)
at java.sql.DriverManager.getConnection(Unknown Source)
1.确定TCP/IP有没有启动.
确定TCP端口对不对, 在TUTORIAL和SAMPLE里的都是1433端口, 可是我SQL SERVER的TCP接听端口是2159.
把程序里的1433改成1459就马上可以用了.
设置方法:
打开SQL SERVER CONFIGURATION MANAGER (不记得