About the sqlstate=08001 error of Toad connection DB2

Source: Internet
Author: User
Tags iptables

The centos6.3+db29.7 of the newly-installed, the database after the import of the Toad connection to access the time error.

DB2 Database Error:error [08001] [IBM] sql30081n A communication Error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error is detected: "10.20.51.155". Communication function Detecting the error: "Selectforconnecttimeout". Protocol specific error code (s): "0", "*", "*". sqlstate=08001 (Remembered answer: "OK". Enable)

For a long time, the internet gave a variety of explanations, including a person mentioned may be related to the firewall.

At first, my practice is very yellow, is to turn off the firewall, the connection can be connected.

$ Service Iptables Stop

Now feel the need to add rules, study the next iptables related commands. Concluded

[Email protected] ~]# iptables-a input-m State--state new-m tcp-p TCP--dport 50000-j ACCEPT

[Email protected] ~]#/etc/rc.d/init.d/iptables Save
iptables:saving firewall rules to/etc/sysconfig/iptables:[OK]
[Email protected] ~]# service iptables restart
iptables:flushing firewall rules: [OK]
Iptables:setting chains to Policy Accept:filter [OK]
iptables:unloading modules: [OK]
iptables:applying firewall rules: [OK]

Try to connect again with the client, still error. View below:

[[Email protected] ~]# service iptables status
Table:filter
Chain INPUT (Policy ACCEPT)
Num Target prot opt source destination
1 ACCEPT All – 0.0.0.0/0 0.0.0.0/0 State related,established
2 ACCEPT ICMP--0.0.0.0/0 0.0.0.0/0
3 ACCEPT All--0.0.0.0/0 0.0.0.0/0
4 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:22
5 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
6 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:50000

Chain FORWARD (Policy ACCEPT)
Num Target prot opt source destination
1 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (Policy ACCEPT)
Num Target prot opt source destination

Reason guessing is a priority issue, and before our new rule there was a reject all, and he forbade access to the parcel.

Query the next corresponding method, found my parameter iptables -A input-m State--state new-m tcp-p TCP--dport 50000-j ACCEPT

Change to Iptables -i input-m State--state new-m tcp-p TCP--dport 50000-j ACCEPT, you should be able to implement
*-a is the insertion rule to the end,-I is inserted to the top

To remove the rule just now:

[[email protected] ~]# iptables-d INPUT 6
[[Email protected] ~]# service iptables status
Table:filter
Chain INPUT (Policy ACCEPT)
Num Target prot opt source destination
1 ACCEPT All – 0.0.0.0/0 0.0.0.0/0 State related,established
2 ACCEPT ICMP--0.0.0.0/0 0.0.0.0/0
3 ACCEPT All--0.0.0.0/0 0.0.0.0/0
4 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:22
5 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (Policy ACCEPT)
Num Target prot opt source destination
1 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (Policy ACCEPT)
Num Target prot opt source destination

Delete succeeded, new append:

[Email protected] ~]# iptables-i input-m State--state new-m tcp-p TCP--dport 50000-j ACCEPT
[[Email protected] ~]# service iptables status
Table:filter
Chain INPUT (Policy ACCEPT)
Num Target prot opt source destination
1 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 State NEW TCP dpt:50000
2 ACCEPT All – 0.0.0.0/0 0.0.0.0/0 State related,established
3 ACCEPT ICMP--0.0.0.0/0 0.0.0.0/0
4 ACCEPT All--0.0.0.0/0 0.0.0.0/0
5 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:22
6 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (Policy ACCEPT)
Num Target prot opt source destination
1 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (Policy ACCEPT)
Num Target prot opt source destination

Try connecting again, OK connected.

This time remember to save the changes you just made. Otherwise the next service Iptables Restart event occurs, then this setting is invalid, the connection fails.

[[email protected] ~]#/etc/rc.d/init.d/iptables Save
iptables:saving firewall rules to/etc/sysconfig/ iptables:[OK]
[[email protected] ~]# service iptables Restart
iptables:flushing firewall rules: [OK]
IP Tables:setting chains to policy accept:filter [OK]
iptables:unloading modules: [OK]
Iptables:applying Firewa LL rules: [OK]
[[email protected] ~]# service iptables status
Table:filter
Chain INPUT (policy ACCEPT)
num Target prot opt source destination
1 Accept TCP--0.0.0.0/0 0.0.0.0/0 State NEW TCP dpt:50000
2 Accept All- -0.0.0.0/0 0.0.0.0/0 State related,established
3 Accept ICMP--0.0.0.0/0 0.0.0.0/0
4 Accept All--0.0.0.0/0 0.0 .0.0/0
5 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 State NEW TCP dpt:22
6 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with IC mp-host-prohibited

Chain FORWARD (Policy ACCEPT)
Num Target prot opt source destination
1 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (Policy ACCEPT)
Num Target prot opt source destination

To this end.

About the sqlstate=08001 error of Toad connection DB2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.