[GIS] Database connection failed

arccatalogarcgis-10.1arcgis-desktopdatabasepostgresql

I am trying to connect from Arc Cataloge (version 10.1) to postgresql 9.2. But every time I try to make "Database Connection" I am getting this error:

Failed to connect to the specified server.
Underlying DBMS error[could not connect to server: Connection timed out
   Is the server running on host"x.y.z.w" and accepting TCP/IP connections on port 5432?

Postgresql is installed on Centos server (PORT 5432) and I can access it using pgadmin.

Using psql --h X.Y.Z.W -U user -d database on another server I am getting the same error.

here is the content of pg_hba.conf:

 local   all             all                                md5
 # IPv4 local connections:
 host    all             all            X.Y.Z.W/32          md5
 host    all             all             0.0.0.0/0          md5
 host    all             all             127.0.0.1/32       md5
 # IPv6 local connections:
 host    all             all             ::1/128            md5

Also in postgresql.conf:

Listen_addresses = '*'
port=5432

in etc/sysconfig/iptables:

 *filter
  4 :INPUT ACCEPT [0:0]
  5 :FORWARD ACCEPT [0:0]
  6 :OUTPUT ACCEPT [0:0]
  7 :RH-Firewall-1-INPUT - [0:0]
  8 -A INPUT -j RH-Firewall-1-INPUT
  9 -A FORWARD -j RH-Firewall-1-INPUT
 10 -A RH-Firewall-1-INPUT -i lo -j ACCEPT
 11 -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
 12 -A RH-Firewall-1-INPUT -p 50 -j ACCEPT
 13 -A RH-Firewall-1-INPUT -p 51 -j ACCEPT
 14 -A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
 15 -A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
 16 -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
 17 -A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 18 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
 19 -A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
 20 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
 21 -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
 22 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
 23 COMMIT

I also put "postgresql-client-libraries" in /bin directory of ArcGIS for Desktop.

I appreciate any help.

Best Answer

alright ,it is working:

1) in /etc/sysconfig/iptables: I removed line 21 -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

2)pg_hba.conf: I only used this: host all all 0.0.0.0/0 md5