469,883 Members | 1,141 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,883 developers. It's quick & easy.

psql won't connect, though other clients are OK

Hello -
I'm running PG 8.1 on Windows XP.
I've installed the server to run as a service.

The psql command fails to connect to the server, although I can connect with other clients.

When I enter psql -d mydb -h localhost -U admin
I get the following response:
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?


However, with the following steps I can prove that the server is indeed running on localhost and listening on 5432.

First, I run pgAdmin3 and connect to the server. The properties panel shows me that I'm connected to the server via localhost port 5432.
Next, with pgAdmin3 running, I do a netstat and get the following result:

TCP jma:1500 localhost:5432 ESTABLISHED
TCP jma:1502 localhost:5432 ESTABLISHED
TCP jma:5432 localhost:1500 ESTABLISHED
TCP jma:5432 localhost:1502 ESTABLISHED

But if I now run psql, I get the same error message as before.

My postgresql.conf file has the following line:
listen_addresses = 'localhost'
I also tried changed 'localhost' to '*', but the result was the same.

If I leave off the -h option on the psql command, the message is a little different. It says (in part):
... Is the server running on host "???" ...

I've searched the threads in this forum for psql problems and found a few. But not exactly this one.

Can anyone tell me why psql won't connect?
May 16 '07 #1
3 3620
michaelb
534 Expert 512MB
We may need to look at postgresql.conf and pg_hba.conf, but before we get to it, are you running a firewall on this computer?
If yes, could you try to disable it for a minute and run psql again?
May 17 '07 #2
Thank you. It was my Zone Alarm firewall. I turned it off, and it worked.

I originally thought that the firewall was not the problem, because it was letting the other clients connect.

Strange thing though --- when I turned ZA back on, it let psql run. I found that it had created a rule saying psql was OK. bizarre.
May 22 '07 #3
michaelb
534 Expert 512MB
Yes, ZoneAlarm can be tricky. If I remember correctly there could be different ways to allow your programs to work, you can open the specific port#, or you can designate a certain app as trusted... Anyway, the good thing is you got it working!
May 22 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Phil Campaigne | last post: by
4 posts views Thread by Brendan Jurd | last post: by
7 posts views Thread by Mike McGavin | last post: by
33 posts views Thread by John Sidney-Woollett | last post: by
2 posts views Thread by Patrick Hatcher | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.