jtds"Network error IOException Connection refused: connect"问题解决

用jtds作驱动程序连接SQL Server常常遇到这个问题:
java.sql.SQLException: Network error IOException Connection refused: connect
下午查了一些资料,算是得到一些信息,总结一下。
jtds官方网站解释如下:

Why do I get java.sql.SQLException: "Network error IOException: Connection refused: connect" when trying to get a connection?

The "Connection refused" exception is thrown by jTDS when it is unable to connect to the server. There may be a number of reasons why this could happen:

  1. The server name is misspelled or the port number is incorrect.
  2. SQL Server is not configured to use TCP/IP. Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).
  3. There is a firewall blocking port 1433 on the server.

To check whether TCP/IP is enabled and the port is not blocked you can use "telnet <server_host> 1433". Until telnet doesn't connect, jTDS won't either. If you can't figure out why, ask your network administrator for help.

 

解决问题当然是先按照官网来检查了,于是一步步查下来,发现符合现象2,但是通过网络管理工具察看TCP/IP,正常。而现象确实与上文描述相同,打了sp3,sp4补丁。后telnet localhost:1433结果老出现在端口23失败,把防火墙关了,还是错。启动telnet服务,用netstat -a看没有1433,只好改了ms server得端口,可还错原来命令错 telnet localhost 1455不用中间的冒号。可是还是出现“不能打开到“”的连接,登录失败,原来连接字符串错:jdbc:jtds:sqlserver://localhost:1455/<SSH>应该为jdbc:jtds:sqlserver://localhost:1455/SSH

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值