Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having problem connecting to PostgreSQL through Python/Psycopg2.

The PostgreSQL server is running on, CentOS 5.5. I can already connect through LAN workstations using Navicat, I'm pretty sure I had the right post opened in iptables.

But when connecting from Python/psycopg2, I got this error

conn = psycopg2.connect(database='test', user='sql', host='', password='sql')

Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    conn = psycopg2.connect(database='test', user='sql', host='', password='sql')
OperationalError: could not connect to server: Connection timed out (0x0000274C/10060)
        Is the server running on host "" and accepting
        TCP/IP connections on port 5432?

I tried to disable firewall and iptables on both client and server machine, still the same error.

share|improve this question

LAN? You see the error?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.