Re: Problem with host connection - Mailing list pgsql-general

From John Clark L. Naldoza
Subject Re: Problem with host connection
Date
Msg-id 3A9A1A62.CBCF5887@ntsp.nec.co.jp
Whole thread Raw
In response to Problem with host connection  (Jeremy Smith <Jeremy@justasofty.com>)
Responses Re: Problem with host connection
List pgsql-general
Hello Jeremy...

Jeremy Smith wrote:
>
> This is a new area to me, I am rewriting a Microsoft Access
> application for the company

Have you tried using PgAdmin?  It may help you a bit...  Then just iron
out the details afterwards...;-)  It's somewhere in
www.greatbridge.com... I think..;-)

> I work for in Java and Postgres.

JDBC...

>
> I have created a testdatabase called history which I can access with
> <psql history> fine
> as well as from a Perl test app I have written.
> But if I try to specify a host in either my Java test app or psql I
> get the same
> error message
>
> Connection to database 'history' failed.
> connectDB() -- connect() failed: Connection refused
> Is the postmaster running (with -i) at '127.0.0.1' and accepting
> connections on TCP/IP port '5432'?

try a

netstat -a | grep postgres


>
> I also have the same errors when runing under the postgres account.
>
> <psql history> works fine
>
> <psql -p 5432 history) also works fine
>
> <psql -h 127.0.0.1 -p 5432 history> give the following error message
> Connection to database 'history' failed.
> connectDB() -- connect() failed: Connection refused
> Is the postmaster running (with -i) at '127.0.0.1' and accepting
> connections on TCP/IP port '5432'?
>
> <psql -h 192.168.1.168 -p 5432 history> gives the same error
>
> THE NETWORK SEEMS OK:
> PING 127.0.0.1 (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data.
> 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.2 ms
>
> PING 192.168.1.168 (192.168.1.168) from 192.168.1.168 : 56(84) bytes
> of data.
> 64 bytes from 192.168.1.168: icmp_seq=0 ttl=255 time=0.2 ms
>
> THE FILE /etc/rc.d/init.d/postgresql contains the following line
>        su -l postgres -c '/usr/bin/postmaster -i -S -D
> /var/lib/pgsql/data'
> # originaly the -D variable was /var/lib/pgsql but I changed it to the
> same as the PGDATA
> # setting
> # neither seems to make any difference - jeremy

This is how it is started in my machine...;-(

su -l postgres -c "/usr/bin/pg_ctl  -D $PGDATA -p /usr/bin/postmaster
start >/dev/null 2>&1"


The -i option is with /var/lib/pgsql/data/postmaster.opts in my
machine...

>
> THE FILE /var/lib/pgsql/data/pg_hba.conf contains the following lines
> at the end:
> local        all                                         trust
> host         all         127.0.0.1     255.255.255.255   trust

As for PGDATA, it's in the script...

    if [ -f /var/lib/pgsql/PG_VERSION ] && [ -d
/var/lib/pgsql/base/template1 ]
    then
        export PGDATA=/var/lib/pgsql
    else
        export PGDATA=/var/lib/pgsql/data
    fi

What version of PostgreSQL are you running?  What O.S. are you running
it in?  And how did you install postgresql?


Cheers,


John Clark

--
     /) John Clark Naldoza y Lopez                           (\
    / )    Software Design Engineer II                       ( \
  _( (_    _  Web-Application Development                    _) )_
 (((\ \>  /_>    Cable Modem Network Management System <_\  </ /)))
 (\\\\ \_/ /         NEC Telecom Software Phils., Inc.  \ \_/ ////)
  \       /                                              \       /
   \    _/  phone: (+63 32) 233-9142 loc. 3112            \_    /
   /   /  cellphone: (+63 919) xxx-xxxx                     \   \
  /   / email: njclark@ntsp.nec.co.jp                        \   \

pgsql-general by date:

Previous
From: Jeremy Smith
Date:
Subject: Problem with host connection
Next
From: Peter Schindler
Date:
Subject: Re: [INTERFACES] IPC Shared Memory (fwd)