pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Postgres-JDBC question
7+ messages / 7 participants
[nested] [flat]

* Postgres-JDBC question
@ 2006-01-27 14:31  Sean <sean.conlon@4expertsolutions.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Sean @ 2006-01-27 14:31 UTC (permalink / raw)
  To: pgsql-jdbc

I am using Hibernate to connect to my PostgreSQL (btw - I love) database,
and can connect my app and the db when using localhost, but when I try to
connect via an ip address, it blows up telling me that the connection was
refused.  I have set the postmaster to listen for TCP/IP connections, but
still does not work.  Any suggestions? 

 

Thanks,

   Sean 

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Postgres-JDBC question
@ 2006-01-27 18:41  Mark Lewis <mark.lewis@mir3.com>
  parent: Sean <sean.conlon@4expertsolutions.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Mark Lewis @ 2006-01-27 18:41 UTC (permalink / raw)
  To: Sean <sean.conlon@4expertsolutions.com>; +Cc: pgsql-jdbc

This usually means that you have allowed TCP/IP connections in
postgresql.conf, but haven't added a rule allowing remote access in
pg_hba.conf for anything other than localhost.

A sample pg_hba.conf line to allow any host on the network to connect
using MD5 password hashes would be:

host   all    all   0.0.0.0 0.0.0.0 md5

-- Mark Lewis

On Fri, 2006-01-27 at 08:31 -0600, Sean wrote:
> I am using Hibernate to connect to my PostgreSQL (btw – I love)
> database, and can connect my app and the db when using localhost, but
> when I try to connect via an ip address, it blows up telling me that
> the connection was refused.  I have set the postmaster to listen for
> TCP/IP connections, but still does not work.  Any suggestions? 
> 
>  
> 
> Thanks,
> 
>    Sean 
> 
> 



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Postgres-JDBC question
@ 2006-01-28 03:13  Philip Yarra <philip@utiba.com>
  parent: Sean <sean.conlon@4expertsolutions.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Philip Yarra @ 2006-01-28 03:13 UTC (permalink / raw)
  To: pgsql-jdbc; +Cc: Sean <sean.conlon@4expertsolutions.com>

On Sat, 28 Jan 2006 01:31 am, Sean wrote:
> and can connect my app and the db when using localhost, but when I try to
> connect via an ip address, it blows up telling me that the connection was
> refused.  I have set the postmaster to listen for TCP/IP connections, but
> still does not work.  Any suggestions?

In postgresql.conf, the default config is to listen only on localhost IP 
address (probably listen_addresses will be set to default value and commented 
out). Change it so that is reads:

listen_addresses = '*'

and re-start the DB. 

As Mark mentioned, you may also want to review your pg_hba.conf file.

Regards, Philip.

-- 

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

-----------------
Utiba Pty Ltd 
This message has been scanned for viruses and
dangerous content by Utiba mail server and is 
believed to be clean.




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Postgres-JDBC question
@ 2006-01-30 09:51  Guillaume Cottenceau <gc@mnc.ch>
  parent: Mark Lewis <mark.lewis@mir3.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Guillaume Cottenceau @ 2006-01-30 09:51 UTC (permalink / raw)
  To: Sean <sean.conlon@4expertsolutions.com>; pgsql-jdbc

Mark Lewis <mark.lewis 'at' mir3.com> writes:

> This usually means that you have allowed TCP/IP connections in
> postgresql.conf, but haven't added a rule allowing remote access in
> pg_hba.conf for anything other than localhost.

Sean - on Linux, you can check this with the following command:

[root@meuh ~] netstat -ltpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:5432                0.0.0.0:*                   LISTEN      3310/postmaster     
                    ^^^ my postgres is listening on all addresses

[...]

tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      3259/master         
                    ^^^ my postfix is listening on localhost only

-- 
Guillaume Cottenceau



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Postgres-JDBC question
@ 2006-02-01 09:01  Myatluk Andrey <Andrey.Myatluk@bercut.ru>
  0 siblings, 1 reply; 7+ messages in thread

From: Myatluk Andrey @ 2006-02-01 09:01 UTC (permalink / raw)
  To: pgsql-jdbc

Guillaume,

On my host if I run netstat I see the following:

tcp        0      0 0.0.0.0:5432                0.0.0.0:*
LISTEN      5557/postmaster

tcp        0      0 :::5432                     :::*
LISTEN      5557/postmaster

Do those mean that my database must be accessible from the outside? I
have access from localhost processes, but my attempts to connect to the
database with pgAdmin failed.

Andrey

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Guillaume
Cottenceau
Sent: Monday, January 30, 2006 12:52 PM
To: Sean; pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Postgres-JDBC question

Mark Lewis <mark.lewis 'at' mir3.com> writes:

> This usually means that you have allowed TCP/IP connections in
> postgresql.conf, but haven't added a rule allowing remote access in
> pg_hba.conf for anything other than localhost.

Sean - on Linux, you can check this with the following command:

[root@meuh ~] netstat -ltpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address
State       PID/Program name   
tcp        0      0 0.0.0.0:5432                0.0.0.0:*
LISTEN      3310/postmaster     
                    ^^^ my postgres is listening on all addresses

[...]

tcp        0      0 127.0.0.1:25                0.0.0.0:*
LISTEN      3259/master         
                    ^^^ my postfix is listening on localhost only

-- 
Guillaume Cottenceau

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Postgres-JDBC question
@ 2006-02-01 14:32  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Myatluk Andrey <Andrey.Myatluk@bercut.ru>
  0 siblings, 1 reply; 7+ messages in thread

From: Tom Lane @ 2006-02-01 14:32 UTC (permalink / raw)
  To: Myatluk Andrey <Andrey.Myatluk@bercut.ru>; +Cc: pgsql-jdbc

"Myatluk Andrey" <Andrey.Myatluk@bercut.ru> writes:
> On my host if I run netstat I see the following:

> tcp        0      0 0.0.0.0:5432                0.0.0.0:*
> LISTEN      5557/postmaster

> tcp        0      0 :::5432                     :::*
> LISTEN      5557/postmaster

> Do those mean that my database must be accessible from the outside? I
> have access from localhost processes, but my attempts to connect to the
> database with pgAdmin failed.

Failed how, exactly?  The netstat output shows that the postmaster is
listening for connections from anyplace, so you have listen_addresses
set properly ... but there are at least two other levels where an
attempted connection might be blocked: kernel packet filtering, or the
contents of pg_hba.conf.  What error message are you getting *exactly*?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Postgres-JDBC question
@ 2006-02-02 16:34  Takeichi Kanzaki Cabrera <tkanzakic@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Takeichi Kanzaki Cabrera @ 2006-02-02 16:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc

Did you have some firewall running on your PC?
Takeichi.

On 2/1/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Myatluk Andrey" <Andrey.Myatluk@bercut.ru> writes:
> > On my host if I run netstat I see the following:
>
> > tcp        0      0 0.0.0.0:5432                0.0.0.0:*
> > LISTEN      5557/postmaster
>
> > tcp        0      0 :::5432                     :::*
> > LISTEN      5557/postmaster
>
> > Do those mean that my database must be accessible from the outside? I
> > have access from localhost processes, but my attempts to connect to the
> > database with pgAdmin failed.
>
> Failed how, exactly?  The netstat output shows that the postmaster is
> listening for connections from anyplace, so you have listen_addresses
> set properly ... but there are at least two other levels where an
> attempted connection might be blocked: kernel packet filtering, or the
> contents of pg_hba.conf.  What error message are you getting *exactly*?
>
>                         regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2006-02-02 16:34 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-27 14:31 Postgres-JDBC question Sean <sean.conlon@4expertsolutions.com>
2006-01-27 18:41 ` Mark Lewis <mark.lewis@mir3.com>
2006-01-30 09:51   ` Guillaume Cottenceau <gc@mnc.ch>
2006-01-28 03:13 ` Philip Yarra <philip@utiba.com>
2006-02-01 09:01 Re: Postgres-JDBC question Myatluk Andrey <Andrey.Myatluk@bercut.ru>
2006-02-01 14:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-02-02 16:34   ` Takeichi Kanzaki Cabrera <tkanzakic@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox