connection problem - Mailing list pgsql-interfaces

From Tuğberk Kara
Subject connection problem
Date
Msg-id beadb2f80607310018s172bc4bm3b45add868b1c58f@mail.gmail.com
Whole thread Raw
Responses Re: connection problem  (Andy Shellam <andy@andycc.net>)
Re: connection problem  (Volkan YAZICI <yazicivo@ttnet.net.tr>)
List pgsql-interfaces
I have a postgresql installed on a remote machine. I want to connect to it with libpq but the connection is not successful.
I have this piece of code for connection in my c file:
 
PGconn *conn=NULL;
char  *conn_str="hostaddr=172.16.11.2 port=5432 dbname=postgres user=postgres password=654321 reqiressl=0";
conn=PGconnectStart(conn_str);
if(PGstatus(conn)=CONNECTION_BAD){
 
  PGerrorMessage(conn);
}
else{
 
printf("connected");
 
}
 
But I can not connect. It exits from the program. I tried also PGconnectdb but it also did not connect to the databse. But I can connect to it thorough pgAdmin with the same credentials. Can you help me please urgently!'!!!
 
 
 

pgsql-interfaces by date:

Previous
From:
Date:
Subject: Re: SPI_getvalue fails
Next
From: Andy Shellam
Date:
Subject: Re: connection problem