No connection could be made because the target machine actively refused it

Started by Bill Toddalmost 17 years ago3 messagesgeneral
Jump to latest
#1Bill Todd
pg@dbginc.com

I am trying to connect to a PostgreSQL server from another machine on my
small home network. When I click the Test button in the ODBC data mnager
for my system DSN I get the error "No connection could be made because
the target machine actively refused it." That may not be the exact
message but it is close.

I have no problem connecting using localhost on the machine where
PostgresSQL is running. However, if I connect using the machine's IP
address (10.0.0.9) either locally or from another PC I get the error
above. I have disabled the Windows firewall and my antivirus software
but the error persists.

Any suggestions? I am new to PostgreSQL so assume I have done something
really dumb.<g>

Bill

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Bill Todd (#1)
Re: No connection could be made because the target machine actively refused it

In response to Bill Todd :

I am trying to connect to a PostgreSQL server from another machine on my
small home network. When I click the Test button in the ODBC data mnager
for my system DSN I get the error "No connection could be made because
the target machine actively refused it." That may not be the exact
message but it is close.

I have no problem connecting using localhost on the machine where
PostgresSQL is running. However, if I connect using the machine's IP
address (10.0.0.9) either locally or from another PC I get the error
above. I have disabled the Windows firewall and my antivirus software
but the error persists.

Any suggestions? I am new to PostgreSQL so assume I have done something
really dumb.<g>

You have to edit your postgresql.conf:

listen_addresses = '*'

and your pg_hba.conf to enable remote access. Read the documentation and
the comments at the end of the pg_hba.conf - file.

Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

#3Jasen Betts
jasen@xnet.co.nz
In reply to: Bill Todd (#1)
Re: No connection could be made because the target machine actively refused it

On 2009-04-22, Bill Todd <pg@dbginc.com> wrote:

I am trying to connect to a PostgreSQL server from another machine on my
small home network. When I click the Test button in the ODBC data mnager
for my system DSN I get the error "No connection could be made because
the target machine actively refused it." That may not be the exact
message but it is close.

You mention ODBC so I'm going to assUme both PCs are running windows.

I have no problem connecting using localhost on the machine where
PostgresSQL is running. However, if I connect using the machine's IP
address (10.0.0.9) either locally or from another PC I get the error
above. I have disabled the Windows firewall and my antivirus software
but the error persists.

Any suggestions? I am new to PostgreSQL so assume I have done something
really dumb.<g>

upto three things..

1: open port 5432/TCP in any firewalls

2: in postgresql.conf file it should not say 'listen addresses="localhost"'
listen_addresses="*" is good unless your server doubles as a firewall/router
in which case you probably want to list the lan interfaces (and localhost).

3: you may need to modify pg_hba.conf too.

at work we wrap the postgresql MSI installer with our own NSIS installer and
optionally (attempt to) do those tweaks

these conf files are in the postgres "data" directory on windows
machines, there may be a link in your start menu for editing them.