敘述: 以jdbc去連會發生,連到第一個node成功,但重連時連到第二個node會失敗: 出現JDBC connection Failure : Network Adapter Could not establish connection 訊息。
1. 在jdbc connection string 中 要確定 (SERVER = DEDICATED) 模式去連,因server 如果為shared server,須在client端指定AP連線為dedicated方式,connection request 才不會有資源切換共享。
2.在/etc/hosts沒有設定好hostsnames/ip ,使得listener 無法把connection request 導到該主機去。
3.DB端有設定防火牆,且沒開放1521 port
(以redhat4 ES為例)
vi /etc/sysconfig/iptables
將
"""-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited"""
改為
"""-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1520:1523 -j ACCEPT"""
允許1520到1523的port
[root@localhost ~]# service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
4.亦或是listener 沒有啟動..
$lsnrctl start
Ref:
Oracle jdbc Frequently Asked Questions
http://www.oracle.com/technology/deploy/availability/htdocs/9ifaq.html#A20
139775.1
JDBC Connection Failure Network Adapter Could not Establish Connection
沒有留言:
張貼留言