Java DB2 jdbc 连接错误连接被拒绝。错误代码=-4499,SQLSTATE=08001
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32289409/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
DB2 jdbc connection error Connection refused. ERRORCODE=-4499, SQLSTATE=08001
提问by Mike Storey
I have a new DB2 server (v10.5.0.3), and I can connect to the database locally just fine.
我有一个新的 DB2 服务器(v10.5.0.3),我可以在本地连接到数据库就好了。
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=swg21403644I have confirmed that
尝试使用 JDBC 从远程服务器连接时,出现“连接被拒绝。ERRORCODE=-4499,SQLSTATE=08001”错误。根据此处找到的信息https://www-304.ibm.com/support/docview.wss?uid=swg21403644我已经确认
[db2inst1@db2 ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=db2.xxxx.com
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=xxxxxx
and
和
[db2inst1@db2 ~]$ db2 get database manager configuration | grep -i svce
TCP/IP Service name (SVCENAME) = 50001
SSL service name (SSL_SVCENAME) =
with these JDBC connection values
使用这些 JDBC 连接值
driver=com.ibm.db2.jcc.DB2Driver
url=jdbc:db2://db2.xxxxx.com:50001/TESTGEN
username=XXXXXXXX
password=XXXXXXX
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.
我已经确认两台服务器上的防火墙都打开了端口 50000 和 50001。我已经没有想法了,非常感谢任何帮助。
回答by Mike Storey
It was indeed a network error. I'm not fully sure which fix was the most important but I made sure telnet was enabled and white listed the DB2 process in the RHEL firewall configuration.
确实是网络错误。我不完全确定哪个修复是最重要的,但我确保 telnet 已启用,并且在 RHEL 防火墙配置中将 DB2 进程列入白名单。
回答by Bob Marlone
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.
我遇到了同样的问题...它是由 IPV6 引起的... URL 连接指向 localhost,解析为 ::1(localhost 的 IPV6 地址)并且 DB2 服务器没有列出 IPV6 协议。
I resolved by modify the c:\windows\system32\driver\etc\host file : I uncomment the line 127.0.0.1 locahost to force ipv4 resolution name of locahost... and it's works.
我通过修改 c:\windows\system32\driver\etc\host 文件来解决:我取消注释 127.0.0.1 locahost 行以强制 locahost 的 ipv4 解析名称......并且它的工作原理。
I hope that helps. (sorry for my English)
我希望这有帮助。(对不起我的英语不好)