DB2 jdbc 连接错误连接被拒绝.错误代码=-4499,SQLSTATE=08001

2022-01-14 00:00:00 db2 jdbc java

我有一个新的DB2服务器(v10.5.0.3),我可以在本地连接到数据库就好了.

I have a new DB2 server (v10.5.0.3), and I can connect to the database locally just fine.

尝试使用 JDBC 从远程服务器连接时,我收到连接被拒绝.ERRORCODE=-4499, SQLSTATE=08001"错误.基于此处找到的信息 https://www-304.ibm.com/support/docview.wss?uid=swg21403644 我已经确认了

When trying to connect from a remote server using JDBC I am getting the "Connection refused. ERRORCODE=-4499, SQLSTATE=08001" error. Based on information found here https://www-304.ibm.com/support/docview.wss?uid=swg21403644 I have confirmed that

[db2inst1@db2 ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=db2.xxxx.com
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=xxxxxx

[db2inst1@db2 ~]$ db2 get database manager configuration | grep -i svce
 TCP/IP Service name                          (SVCENAME) = 50001
 SSL service name                         (SSL_SVCENAME) = 

使用这些 JDBC 连接值

with these JDBC connection values

driver=com.ibm.db2.jcc.DB2Driver
url=jdbc:db2://db2.xxxxx.com:50001/TESTGEN
username=XXXXXXXX
password=XXXXXXX

我已经验证了两台服务器上的防火墙都打开了端口 50000 和 50001.我的想法已经用完了,非常感谢任何帮助.

I have verified that the firewall on the both servers have opened ports 50000 and 50001. I've run out of ideas, any help is greatly appreciated.

推荐答案

我也遇到了同样的问题...是IPV6引起的...指向 localhost 的 URL 连接点,解析为 ::1(localhost 的 IPV6 地址),并且 DB2 服务器没有列出 IPV6 协议.

I had the same trouble... Its was caused by IPV6... The URL connection point to localhost, resolved as ::1 (the IPV6 address of localhost) and DB2 server doens't listing IPV6 protocol.

我通过修改 c:windowssystem32driveretchost 文件来解决:我取消注释 127.0.0.1 locahost 行以强制 locahost 的 ipv4 解析名称...并且它有效.

I resolved by modify the c:windowssystem32driveretchost file : I uncomment the line 127.0.0.1 locahost to force ipv4 resolution name of locahost... and it's works.

我希望这会有所帮助.(对不起我的英语)

相关文章