mysql sqlstate 08001_关于Toad连接DB2的sqlstate=08001错误
新装的centos6.3+db29.7,数据库导入完了的之后用Toad连接访问之的时候出错了。
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 was detected: "10.20.51.155". Communication function detecting the error: "selectForConnectTimeout". Protocol specific error code(s): "0", "*", "*". SQLSTATE=08001 (Remembered answer: "OK". Enable)
查了好久,网上给了各种解释,其中有个人提到了可能与防火墙有关。
一开始我的做法很黄,就是把防火墙关了,连接下就能连上了。
$ service iptables stop
现在觉得需要添加规则,研究了下iptables相关命令。得出
[root@localhost ~]# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 50000 -j ACCEPT
[root@localhost ~]# /etc/rc.d/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@localhost ~]# 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 ]
再次尝试用客户端连接,依然报错。查看下:
[root@localhost ~]# 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
原因猜测是优先顺序问题,在我们新规则之前有一个reject all,他禁止了对地发包的访问。
查询了下对应方法,发现我参数 iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 50000 -j ACCEPT
改成 iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 50000 -j ACCEPT,应该可以实现
*-A是插入规则到末尾,-I是插入到顶部
把刚刚的规则删除:
[root@localhost ~]# iptables -D INPUT 6
[root@localhost ~]# 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
删除成功,从新追加:
[root@localhost ~]# iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 50000 -j ACCEPT
[root@localhost ~]# 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
再次尝试连接,OK连上了。
这个时候要记得保存刚刚的更改。不然下次service iptables restart事件发生的话,那么此次设置无效,连接失败。
[root@localhost ~]# /etc/rc.d/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@localhost ~]# 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 ]
[root@localhost ~]# 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
到此结束。
mysql sqlstate 08001_关于Toad连接DB2的sqlstate=08001错误相关推荐
- 连接DB2 抛异常SQL Error SQLCODE=-204, SQLSTATE=42704
连接DB2 抛异常SQL Error SQLCODE=-204, SQLSTATE=42704 参考文章: (1)连接DB2 抛异常SQL Error SQLCODE=-204, SQLSTATE=4 ...
- 连接DB2报错:ERRORCODE=-4499, SQLSTATE=08004
前言: 前几天用SQuirrel SQL Client (松鼠客户端)连接DB2报错,具体信息如下: java.util.concurrent.ExecutionException: java ...
- 连接DB2报错:ERRORCODE=-4499, SQLSTATE=08001
连接DB2时遇到报错:ERRORCODE=-4499, SQLSTATE=08001,仔细检查了一下,发现Databse Server是localhost,改成想要连接的数据库服务器地址就能正常连接了 ...
- 把C#.NET程序移植到DB2上的经验浅谈(C#连接DB2可以用IBM.Data.DB2.dll)
感谢博客园不再封杀,差点儿搬家的念头都产生了,博客园还是有大胸怀,继续留在博客园写口水文应该没错,娱乐自己.娱乐大家,给枯燥的编程生活增加一点儿笑料,也给大家充当个开心果,让大家高兴一下下.轻松一下下 ...
- java jdbc 连接mysql数据库,Java 通过JDBC连接Mysql数据库
JDBC(Java Data Base Connectivity,java数据库连接)是一种用于执行SQL语句的Java API,可以为多种关系数据库提供统一访问,它由一组用Java语言编写的类和接口 ...
- python连接sql_Python连接DB2数据库
在工作中遇到了这样的情况,项目中需要连接IBM的关系型数据库(DB2),关于这方面的库比较稀少,其中 ibm_db 是比较好用的一个库,网上也有教程,但是好像不准确,也不太详细,错误百出,没办法只能拿 ...
- db2 jdbc 连接池_【转】java jdbc连接db2
/**了解基础情况**/ 对于Java程序员而言,DB2 提供了两种应用程序编程接口(API):JDBC 和 SQLJ. JDBC: JDBC 驱动程序分为旧的/CLI 驱动程序和新的通用 JDBC ...
- php连接db2失败,php – 通过pdo_ibm模块连接到db2手动配置的错误SQL10007N -5005
我很难使用pdo_ibm连接到远程db2数据库,我按照IBM上的说明配置pdo_ibm库和 linux客户端但由于我的php没有手动配置但是通过apt-get安装我不确定当前的错误是否可能是由于配置错 ...
- mysql sqlstate 08001_sqlstate 08001错误
展开全部 解决方案(08001错误表明无法与应用程序服务器或其他服务器建立连接): 1.检查端口号配置是否正确. 配置参数62616964757a686964616fe4b893e5b19e31333 ...
最新文章
- Java中的static关键字详解
- 乔布斯 1973 年求职申请表曝光,拍出 222400 美元高价!
- IUSR_ 计算机名和IWAM_ 计算机名帐户的用户名和密码
- C,C++开源项目中的100个Bugs
- 融合 MF 和 RNN 的电影推荐系统
- PYTHON-迭代器,xxx生成式
- MediatR 在.NET应用中的实践
- vue插槽面试题_VUE面试题解析,半年出一篇,建议收藏!
- iOS开发极光推送显示 开发证书没有通过验证 是否重新上传证书?解决方法
- HDOJ2003求绝对值
- 19. JavaScript RegExp 对象
- ftp服务器默认文件夹,ftp服务器设置文件目录
- 如何查看sqlserver数据库文件位置
- 前端英文首字母转大写
- 如何申请自己的免费企业邮箱
- Java学习笔记(六):Java泛型
- vuex中subscribe的使用
- rospy 让机器人绕圈、矩形行走(碰到障碍物停止)
- 用JAVA生成GIF动画
- 广东惠州公安一名副所长因公牺牲
热门文章
- 边缘计算精华问答 | 边缘计算有哪些应用场景?
- golang 排序_堆 堆排序 优先队列 图文详解(Golang实现)
- 让代码更简洁 和@Autowired说分手, 迎接 @RequiredArgsConstructor注解
- 检测到目标FTP服务可匿名访问
- Guns导入开发工具
- Linux环境安装并配置Maven
- break continye
- Java-逻辑运算符、位运算符
- php findbysql,hibernate的findByExample
- 子网规划与组网实验_【干货】从0到1,“大型WLAN组网”基础知识分享~