Обсуждение: Connection refused. Check that the hostname and port are correct

Поиск
Список
Период
Сортировка

Connection refused. Check that the hostname and port are correct

От
Omer Mustafa
Дата:
Hi,

I am new to PostgreSQL. I am trying to connect to my PostgreSQL database
installed on Unix. I am getting the following error message,

***************************************************************************
An error occured while establishing the connection.
    Type: org.postgresql.util.PSQLException   Error Code: 0   SQL State:
08004
Message:
    Connection refused. Check that the hostname and port are correct and
that the postmaster is accepting TCP/IP connections.
Exception: java.net.ConnectException: Connection refused: connect
***************************************************************************

I have checked port number, user name, password and they are all
correct. I have also checked that the postmaster is also running.

*******************************
postgres 25398 25344   0 11:57:51 pts/2       0:00 psql syslog
postgres 25548 25546   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25613 25580   0 16:43:01 pts/3       0:00 grep post
postgres 25344 25301   0 10:57:05 pts/2       0:00 -tcsh
postgres 25546     1   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25550 25549   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25549 25546   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25580 25443   0 16:34:17 pts/3       0:00 -tcsh
*******************************

I have the following settings in my configuration file

******************
host    syslog      sysloguser  10.10.10.10/32        trust
host    syslog      sysloguser  192.168.0.0/32        trust
*****************

Please advice what am I doing wrong

--

Thanks and Regards
Omer Mustafa
Oracle Application DBA
omustafa@internode.com.au
Internode, Level 1, 132 Grenfell Street
ADELAIDE SA 5000
Ph:    08 8228 2379
Mobile # 0421 038839

Re: Connection refused. Check that the hostname and port

От
Jeff Frost
Дата:
Please do not remove the list from the Cc when replying.

On Thu, 27 Jul 2006, Omer Mustafa wrote:

> FATAL: no pg_hba.conf entry for host "203.26.95.33", user "sysloguser",
> database "syslog"
>
> but i have this entry in my pg_hba file.

Most likely it is because you didn't reload the postgresql service after
making the changes or because it is matching another entry first.  The
pg_hba.conf is parsed in a top down manner with the first match winning.
Post your pg_hba.conf and we can likely help you.  Remember that you must
reload the postgresql service after making changes.


>
> Jeff Frost wrote:
>> On Thu, 20 Jul 2006, Omer Mustafa wrote:
>>
>>>   Connection refused. Check that the hostname and port are correct and
>>> that the postmaster is accepting TCP/IP connections.
>>> Exception: java.net.ConnectException: Connection refused: connect
>>> ***************************************************************************
>>>
>>> I have checked port number, user name, password and they are all correct.
>>> I have also checked that the postmaster is also running.
>>
>> Most likely the postgresql server is set to listen for unix socket
>> connections and/or connections from localhost only.  Look for the following
>> in your postgresql.conf file:
>>
>> #listen_addresses = 'localhost' # what IP interface(s) to listen on;
>>                                 # defaults to localhost, '*' = any
>>
>> You most likely want to change that to:
>>
>> listen_addresses = '*'
>>
>> That's from an 8.x config file.  If you have an older version the
>> terminology is likely different, but the effect is similar.
>>
>
>

--
Jeff Frost, Owner     <jeff@frostconsultingllc.com>
Frost Consulting, LLC     http://www.frostconsultingllc.com/
Phone: 650-780-7908    FAX: 650-649-1954

Re: Connection refused. Check that the hostname and port

От
Jeff Frost
Дата:
On Thu, 20 Jul 2006, Omer Mustafa wrote:

>   Connection refused. Check that the hostname and port are correct and that
> the postmaster is accepting TCP/IP connections.
> Exception: java.net.ConnectException: Connection refused: connect
> ***************************************************************************
>
> I have checked port number, user name, password and they are all correct. I
> have also checked that the postmaster is also running.

Most likely the postgresql server is set to listen for unix socket connections
and/or connections from localhost only.  Look for the following in your
postgresql.conf file:

#listen_addresses = 'localhost' # what IP interface(s) to listen on;
                                 # defaults to localhost, '*' = any

You most likely want to change that to:

listen_addresses = '*'

That's from an 8.x config file.  If you have an older version the terminology
is likely different, but the effect is similar.

--
Jeff Frost, Owner     <jeff@frostconsultingllc.com>
Frost Consulting, LLC     http://www.frostconsultingllc.com/
Phone: 650-780-7908    FAX: 650-649-1954

Re: Connection refused. Check that the hostname and port are correct

От
"Shoaib Mir"
Дата:
That appears to be the JDBC driver is not able to connect to the PostgreSQL database.

Try out the following:

- See if there is any firewall running, run 'iptables -F" on the database server machine to disable it for a while and then test the same Java code
- Check the routing tables info and see if there is anything missing there.
- If the above two are okay and still its not connecting try out settng the following in your pg_hba.conf file:

host    all         all         127.0.0.1/32          trust
host    all         all         0.0.0.0/0         trust

and then do a 'pg_ctl reload' and see if that now lets you connect through the JDBC driver or not locally and over the lan.

Thanks,

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 7/20/06, Omer Mustafa < omustafa@internode.com.au> wrote:
Hi,

I am new to PostgreSQL. I am trying to connect to my PostgreSQL database
installed on Unix. I am getting the following error message,

***************************************************************************
An error occured while establishing the connection.
    Type: org.postgresql.util.PSQLException   Error Code: 0   SQL State:
08004
Message:
    Connection refused. Check that the hostname and port are correct and
that the postmaster is accepting TCP/IP connections.
Exception: java.net.ConnectException: Connection refused: connect
***************************************************************************

I have checked port number, user name, password and they are all
correct. I have also checked that the postmaster is also running.

*******************************
postgres 25398 25344   0 11:57:51 pts/2       0:00 psql syslog
postgres 25548 25546   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25613 25580   0 16:43:01 pts/3       0:00 grep post
postgres 25344 25301   0 10:57:05 pts/2       0:00 -tcsh
postgres 25546     1   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25550 25549   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25549 25546   0 16:01:35 pts/3       0:00
/usr/local/pgsql/bin/postmaster
postgres 25580 25443   0 16:34:17 pts/3       0:00 -tcsh
*******************************

I have the following settings in my configuration file

******************
host    syslog      sysloguser  10.10.10.10/32        trust
host    syslog      sysloguser  192.168.0.0/32        trust
*****************

Please advice what am I doing wrong

--

Thanks and Regards
Omer Mustafa
Oracle Application DBA
omustafa@internode.com.au
Internode, Level 1, 132 Grenfell Street
ADELAIDE SA 5000
Ph:    08 8228 2379
Mobile # 0421 038839

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings