Thread: Cannot connect to postgresql

Cannot connect to postgresql

From
Peter Bradley
Date:
I have just downloaded and installed postgresql and pgadmin3.

In Postgresql I have done no more than create a test database (with no
tables or anything) called testdb.  I can connect to this dataabase as
the user postgres from the command line interface (./psql testdb).  The
postgres user is the user who started the server.

When I try to add a server in pgadmin3 I firstly get the following
warning:

Warning:
Mailcap file /home/peter/.mailcap, line 59: incomplete entry ignored.

which seems a bit odd, since that refers to crossover office's entry for
Word 97 ...

Then I enter the details for the new server (localhost, testdb,
postgres), but pgadmin3 hangs when I click on OK.  I've tried it with
the trusted checkbox both selected and deselected.

netstat -l confirms that the server is listening on port 5432.

If I try to telnet to port 5432 I get "Connection refused" both as my
own user and as the postgres user.

My pg_hba.conf file is just the default file, which says that
connections should be permitted for any local postgresql user.  So I
gather from that that the postgres user should be OK.

I'd look in the logs, but I don't know where to look (or what to look
for ...).

I'd be grateful for any help

Thanks in advance

Peter



Re: Cannot connect to postgresql

From
Andreas Pflug
Date:
Peter Bradley wrote:
> I have just downloaded and installed postgresql and pgadmin3.
> 
> In Postgresql I have done no more than create a test database (with no
> tables or anything) called testdb.  I can connect to this dataabase as
> the user postgres from the command line interface (./psql testdb).  The
> postgres user is the user who started the server.
> 
> When I try to add a server in pgadmin3 I firstly get the following
> warning:
> 
> Warning:
> Mailcap file /home/peter/.mailcap, line 59: incomplete entry ignored.
> 
> which seems a bit odd, since that refers to crossover office's entry for
> Word 97 ...
> 
> Then I enter the details for the new server (localhost, testdb,
> postgres), but pgadmin3 hangs when I click on OK.  I've tried it with
> the trusted checkbox both selected and deselected.
> 
> netstat -l confirms that the server is listening on port 5432.
> 
> If I try to telnet to port 5432 I get "Connection refused" both as my
> own user and as the postgres user.
> 
> My pg_hba.conf file is just the default file, which says that
> connections should be permitted for any local postgresql user.  So I
> gather from that that the postgres user should be OK.
> 
> I'd look in the logs, but I don't know where to look (or what to look
> for ...).
> 
> I'd be grateful for any help

Please supply informations about system and pgadmin3 version 
(binary/source?)

Regards,
Andreas


Re: Cannot connect to postgresql

From
Peter Bradley
Date:
On Sun, 2004-07-18 at 21:14, Andreas Pflug wrote:
> Peter Bradley wrote:
> > I have just downloaded and installed postgresql and pgadmin3.
> > 
> > In Postgresql I have done no more than create a test database (with no
> > tables or anything) called testdb.  I can connect to this dataabase as
> > the user postgres from the command line interface (./psql testdb).  The
> > postgres user is the user who started the server.
> > 
> > When I try to add a server in pgadmin3 I firstly get the following
> > warning:
> > 
> > Warning:
> > Mailcap file /home/peter/.mailcap, line 59: incomplete entry ignored.
> > 
> > which seems a bit odd, since that refers to crossover office's entry for
> > Word 97 ...
> > 
> > Then I enter the details for the new server (localhost, testdb,
> > postgres), but pgadmin3 hangs when I click on OK.  I've tried it with
> > the trusted checkbox both selected and deselected.
> > 
> > netstat -l confirms that the server is listening on port 5432.
> > 
> > If I try to telnet to port 5432 I get "Connection refused" both as my
> > own user and as the postgres user.
> > 
> > My pg_hba.conf file is just the default file, which says that
> > connections should be permitted for any local postgresql user.  So I
> > gather from that that the postgres user should be OK.
> > 
> > I'd look in the logs, but I don't know where to look (or what to look
> > for ...).
> > 
> > I'd be grateful for any help
> 
> Please supply informations about system and pgadmin3 version 
> (binary/source?)
> 
> Regards,
> Andreas
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org

Good point Andreas.  Apologies.

I'm running SuSE Linux 8.2.  Postgresql 7.4.3. pgadmin3-1.0.2.

The Postgresql installation is from the source files.  pgadmin is from
the rpm for SuSE 8.2.

My apologies again for not including that info before.

Thanks

Peter



Re: Cannot connect to postgresql

From
Andreas Pflug
Date:
Peter Bradley wrote:
>>>When I try to add a server in pgadmin3 I firstly get the following
>>>warning:
>>>
>>>Warning:
>>>Mailcap file /home/peter/.mailcap, line 59: incomplete entry ignored.

This message can't originate from pgadmin3 itself, are you starting it 
from a desktop icon?
Try running it from a command line (and check .mailcap, line 59 is 
probably corrupted).

>>>Then I enter the details for the new server (localhost, testdb,
>>>postgres), but pgadmin3 hangs when I click on OK.  I've tried it with
>>>the trusted checkbox both selected and deselected.

SSL or not?
I'm not sure if that RPM is compiled with dynamic SSL support, could be 
the reason. Jean-Michel, any clues?

Regards,
Andreas


Re: Cannot connect to postgresql

From
Adam H.Pendleton
Date:
On Jul 18, 2004, at 4:03 PM, Peter Bradley wrote:

> netstat -l confirms that the server is listening on port 5432.
>
> If I try to telnet to port 5432 I get "Connection refused" both as my
> own user and as the postgres user.

If your postgresql server is indeed listening on TCP port 5432, and you 
issue a telnet command to that port, and get connection refused, then 
there are three probable reasons you cannot connect:

1) Postgresql is listening on a different interface than you are trying 
to connect to.  IOW, it might be listening on 1.2.3.4:5432, and you're 
telnetting to 127.0.0.1:5432.  Your netstat command should show what 
interface it's listening on (ideally, it should be 0.0.0.0:5432, which 
is all interfaces).

2) You've got a firewall installed, blocking port 5432.  A lot of 
firewalls return RST packets (which is what generates the connection 
refused message) to incoming connections.  Make sure iptables isn't 
blocking 5432.

3) You made a typo.  :-)

What is the result of looking at those three items?

ahp

Re: Cannot connect to postgresql

From
Peter Bradley
Date:
On Mon, 2004-07-19 at 11:25, Adam H.Pendleton wrote:
> On Jul 18, 2004, at 4:03 PM, Peter Bradley wrote:
> 
> > netstat -l confirms that the server is listening on port 5432.
> >
> > If I try to telnet to port 5432 I get "Connection refused" both as my
> > own user and as the postgres user.
> 
> If your postgresql server is indeed listening on TCP port 5432, and you 
> issue a telnet command to that port, and get connection refused, then 
> there are three probable reasons you cannot connect:
> 
> 1) Postgresql is listening on a different interface than you are trying 
> to connect to.  IOW, it might be listening on 1.2.3.4:5432, and you're 
> telnetting to 127.0.0.1:5432.  Your netstat command should show what 
> interface it's listening on (ideally, it should be 0.0.0.0:5432, which 
> is all interfaces).
> 
> 2) You've got a firewall installed, blocking port 5432.  A lot of 
> firewalls return RST packets (which is what generates the connection 
> refused message) to incoming connections.  Make sure iptables isn't 
> blocking 5432.
> 
> 3) You made a typo.  :-)
> 
> What is the result of looking at those three items?
> 
> ahp

I made a typo.  :-(

Actually, I failed to pass the -i option to postmaster, which is nearly
as stupid.  Your message above put me on the right track.

Many thanks for all the replies - all of which were helpful and useful. 
I'm just sorry I hadn't paid more attention.  I apologise if anyone
thinks I wasted their time with this.

Cheers

Peter



Re: Cannot connect to postgresql

From
Adam H.Pendleton
Date:
On Jul 19, 2004, at 1:17 PM, Peter Bradley wrote:

> I made a typo.  :-(
>
> Actually, I failed to pass the -i option to postmaster, which is nearly
> as stupid.  Your message above put me on the right track.
>
> Many thanks for all the replies - all of which were helpful and useful.
> I'm just sorry I hadn't paid more attention.  I apologise if anyone
> thinks I wasted their time with this.
>

Not a bit.  I found postgres a little daunting my first time using it, 
but the more I used it the easier I found it.  Happy to help.

ahp