Thread: Database Server Remote connection failed

Database Server Remote connection failed

From
王峰
Date:
Hi,
I can't establish a connection to PostgreSQL(version postgresql-8.2.4) Server. I'am sure what i config is right.
 
Following are what i do to enable remote connection:
 
1. edit /usr/local/pgsql/data/postgresql.conf
enable remote tcp/ip connection:
listen_addresses = '*'
port = 5432
max_connection = 100
 
2. edit /usr/local/pgsql/data/pg_hba.conf
add remote client that will connect to the server to pg_hba.conf
 
for example:
PC_Server IP: 192.168.1.98 Running PostgreSQL Server. Linux OS.
PC_Client IP: 192.168.1.25 Will connect to the PC_Server. Windows XP OS
 
so, i add one line to pg_hba.conf :
host    all    all    192.168.1.25/32    trust
---------------------------------------------------
But when i established a connection to the PC_Server on the PC_Client
(C:\Program Files\PostgreSQL\8.0.0-rc1\bin>psql -h 192.168.1.98 -U postgres postgres)
 
the system give me one message:
psql: could not connect to server: No route to host (0x00002751/10065)
        Is the server running on host "192.168.1.98" and accepting
        TCP/IP connections on port 5432?
---------------------------------------------------------
Please tell me why, or whatever i made mistake.
Thanks!
 
 
 

Re: Database Server Remote connection failed

From
Stefan Kaltenbrunner
Date:
Íõ·å wrote:
> Hi,
> I can't establish a connection to PostgreSQL(version postgresql-8.2.4)
> Server. I'am sure what i config is right.
>
> Following are what i do to enable remote connection:
>
> 1. edit /usr/local/pgsql/data/postgresql.conf
> enable remote tcp/ip connection:
> listen_addresses = '*'
> port = 5432
> max_connection = 100
>
> 2. edit /usr/local/pgsql/data/pg_hba.conf
> add remote client that will connect to the server to pg_hba.conf
>
> for example:
> PC_Server IP: 192.168.1.98 Running PostgreSQL Server. Linux OS.
> PC_Client IP: 192.168.1.25 Will connect to the PC_Server. Windows XP OS
>
> so, i add one line to pg_hba.conf :
> host    all    all    192.168.1.25/32    trust
> ---------------------------------------------------
> But when i established a connection to the PC_Server on the PC_Client
> (C:\Program Files\PostgreSQL\8.0.0-rc1\bin>psql -h 192.168.1.98 -U
> postgres postgres)

8.0.0-rc1 ???

>
> the system give me one message:
> psql: could not connect to server: No route to host (0x00002751/10065)
>         Is the server running on host "192.168.1.98" and accepting
>         TCP/IP connections on port 5432?

well "no route to host" is a network level problem - either you client
is not connected (physically or logically) to that network at all - your
you have a firewall on either the client or the server that is blocking
your requests.


Stefan

Re: Database Server Remote connection failed

From
Heikki Linnakangas
Date:
王峰 wrote:
> Hi,I can't establish a connection to PostgreSQL(version postgresql-8.2.4) Server. I'am sure what i config is right.
Followingare what i do to enable remote connection: 1. edit/usr/local/pgsql/data/postgresql.confenable remote tcp/ip
connection:listen_addresses= '*'port = 5432max_connection = 100 2. edit/usr/local/pgsql/data/pg_hba.confadd remote
clientthat will connect to the server to pg_hba.conf for example:PC_Server IP: 192.168.1.98 Running PostgreSQL Server.
LinuxOS.PC_Client IP: 192.168.1.25 Will connect to the PC_Server. Windows XP OS so, i add one line to pg_hba.conf :host
  all    all    192.168.1.25/32    trust---------------------------------------------------But when i established a
connectionto the PC_Server on the PC_Client(C:\Program Files\PostgreSQL\8.0.0-rc1\bin>psql -h 192.168.1.98 -U postgres
postgres)the system give me one message: 
> psql: could not connect to server: No route to host (0x00002751/10065)
>         Is the server running on host "192.168.1.98" and accepting
>         TCP/IP connections on port 5432?---------------------------------------------------------Please tell me why,
orwhatever i made mistake.Thanks!    

"No route to host" sounds like a network configuration problem. Make
sure you can reach the server from the client with "ping 192.168.1.98".

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com