pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedconnection problem
3+ messages / 3 participants
[nested] [flat]
* connection problem
@ 2006-07-31 07:18 =?ISO-8859-9?Q?Tu=F0berk_Kara?= <tugberkkara@gmail.com>
2006-07-31 16:16 ` Re: connection problem Andy Shellam <andy@andycc.net>
2006-08-01 06:02 ` Re: connection problem Volkan YAZICI <yazicivo@ttnet.net.tr>
0 siblings, 2 replies; 3+ messages in thread
From: Tuðberk Kara @ 2006-07-31 07:18 UTC (permalink / raw)
To: 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!'!!!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: connection problem
2006-07-31 07:18 connection problem =?ISO-8859-9?Q?Tu=F0berk_Kara?= <tugberkkara@gmail.com>
@ 2006-07-31 16:16 ` Andy Shellam <andy@andycc.net>
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shellam @ 2006-07-31 16:16 UTC (permalink / raw)
To: Tuğberk Kara <tugberkkara@gmail.com>; +Cc: pgsql-interfaces
Try "host=172.16.11.2" at the start of your connection string. I
believe the parameter is "host" not "hostaddr".
Andy.
Tuğberk Kara wrote:
> 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 <http://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!'!!!
>
>
>
> !DSPAM:14,44ce2c59143296589895338!
--
Andy Shellam <mailto:andy.shellam@mailnetwork.co.uk>,
the Mail Network <http://www.mailnetwork.co.uk/;
NetServe Support - we don't go the extra mile; we go the whole distance!
p: (+44) 0 845 838 0879 / +44 0 7818 000834
w: www.mailnetwork.co.uk <http://www.mailnetwork.co.uk/;
e: support@mailnetwork.co.uk <mailto:support@mailnetwork.co.uk>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: connection problem
2006-07-31 07:18 connection problem =?ISO-8859-9?Q?Tu=F0berk_Kara?= <tugberkkara@gmail.com>
@ 2006-08-01 06:02 ` Volkan YAZICI <yazicivo@ttnet.net.tr>
1 sibling, 0 replies; 3+ messages in thread
From: Volkan YAZICI @ 2006-08-01 06:02 UTC (permalink / raw)
To: Tuğberk Kara <tugberkkara@gmail.com>; +Cc: pgsql-interfaces
On Jul 31 10:18, Tuğberk Kara wrote:
> 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");
>
> }
You're using totally wrong functions. There's even doesn't exist a
function called PGconnectStart().
First of all, I'd suggest you to either reading libpq manual[1] in the
PostgreSQL documentation or "PostgreSQL ile Programlama"[2] (in Turkish)
book's C API related section.
[1] www.postgresql.org/docs/current/interactive/libpq.html
[2] http://www.students.itu.edu.tr/~yazicivo/doc/postgresql-ile-programlama-20060214.pdf
Regards.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-08-01 06:02 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-31 07:18 connection problem =?ISO-8859-9?Q?Tu=F0berk_Kara?= <tugberkkara@gmail.com>
2006-07-31 16:16 ` Andy Shellam <andy@andycc.net>
2006-08-01 06:02 ` Volkan YAZICI <yazicivo@ttnet.net.tr>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox