db2 连接报错connect。 ERRORCODE=-4499, SQLSTATE=08001(转载)

在使用data studio连接远程DB2数据库时报错如下:
[jcc][Thread:main][SQLException@5b775b77] java.sql.SQLException
[jcc][Thread:main][SQLException@5b775b77] SQL state  = 08001
[jcc][Thread:main][SQLException@5b775b77] Error code = -4499
[jcc][Thread:main][SQLException@5b775b77] Message    = [jcc][t4][2043][11550][4.13.111] 异常 java.net.ConnectException:打开端口 50,000 上服务器 192.168.1.107/192.168.1.107 的套接字时出错,消息为:Connection timed out: connect。 ERRORCODE=-4499, SQLSTATE=08001
[jcc][Thread:main][SQLException@5b775b77] Stack trace follows
com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2043][11550][4.13.111] 异常 java.net.ConnectException:打开端口 50,000 上服务器 192.168.1.107/192.168.1.107 的套接字时出错,消息为:Connection timed out: connect。 ERRORCODE=-4499, SQLSTATE=08001
com.ibm.db2.jcc.am.id.a(id.java:320)
 
Cause:
Error 1: DB2 return code is -4499
Four  problems might be the cause of this error.
1、 Firewall is not stopped
2、DB2 is stopped.
3、The wrong DB2 database listening port number is specified.
4、The wrong database name is specified.
 
solution:
1、Check whether firewall is stopped.
chkconfig iptables off  永久性关闭
service iptables stop  重启主机后失效
2、Check whether DB2 is started.
db2 list db directory
3、Check the DB2 listening port
db2 get dbm cfg |grep SVCENAME,查看TCP/IP服务名称和/etc/services中定义的db2服务名称是否匹配
4、Check the DB2COMM
db2set -all 检查DB2COMM是否是TCPIP
原文地址:https://www.cnblogs.com/jjzd/p/6372908.html