About could not connect to server: Connection timed out

From: 黄永卫 <yongwei(dot)huang(at)gmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: About could not connect to server: Connection timed out
Date: 2009-10-20 04:12:51
Message-ID: 4add38d5.171bf30a.7a5e.ffffab15@mx.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

When I use ecpg code to download File from database, error occurred
occasionally as below:

“could not connect to server: Connection timed out Is the server running
on host "DB" and accepting TCP/IP connections on port 5432?”

This my code:

conn = PQsetdbLogin(host, NULL, NULL, NULL, database,
username, "") ;

if (PQstatus (conn) != CONNECTION_BAD){

PQexec(conn, "BEGIN");

if (lo_export(conn,oidImage_Data,chImageName) == -1) {

printf("PQSTATUS=%s \n",PQerrorMessage(conn));

PQfinish (conn) ;

printf("EXPORT %s ERROR! SQL STATE = %s\n
",chImageName,sqlca.sqlstate);

}

printf("PQSTATUS=%s \n",PQstatus(conn));

PQexec(conn, "COMMIT");

This log was found in postgres.log:

Oct 18 10:44:35 SUC02 postgres[10159]: [7-1] LOG: database system is ready

Oct 18 10:44:35 SUC02 postgres[10159]: [8-1] LOG: transaction ID wrap limit
is 3343152371, limited by database "template1"

Oct 18 10:46:11 SUC02 postgres[10997]: [2-1] LOG: unexpected EOF on client
connection

Oct 18 10:46:11 SUC02 postgres[15899]: [2-1] LOG: could not receive data
from client: Connection reset by peer

Oct 18 10:46:11 SUC02 postgres[15899]: [3-1] LOG: unexpected EOF on client
connection

What is the problem ? What should I <javascript:void(0)> investigate ?

Please help ! Thank you very much !

Ray Huang

2009-10-20

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2009-10-20 04:33:54 Re: About could not connect to server: Connection timed out
Previous Message Craig Ringer 2009-10-20 03:26:48 Re: Un successful Restoration of DATA using WAL files