From: | loic lecoeur <loleco666(at)yahoo(dot)fr> |
---|---|
To: | pgsql-ports(at)postgresql(dot)org |
Subject: | problem whith libpq |
Date: | 2000-02-04 07:39:28 |
Message-ID: | 20000204073928.15965.qmail@web1005.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-ports |
I am a french student and i must do a sql database
witch interract with a vxworks system.
My solution is to use a client/serveur in C and a sql
database controled by a C program
Is it the best solution??
if no what is it?
if yes,i wrote a test program in c but it doesn't
work.
he is based on your example "sample program" at the
end of the chapter 16 of your documentation
can you tell me why i can't compile it ?
there is all the code of the application here
If you can't help me , can you give me a place or mail
of persons who can help me ?
Thank you :)
//command for postmaster
postmaster -i -p 12032 -D /home/magic/db
//source code of the test application testpqlib.c:
#include <stdio.h>
#include <pgsql/pqlib-fe.h>
void exit_nicely(PGconn *conn)
{
PQfinish(conn);
exit(1);
}
main()
{
char *pghost,
*pgport,
*pgoption,
*pgtty,
*dbname;
PGconn *conn;
PGresult *res;
char toto[]="12032";
/*initialisation des parametres de la connection*/
pghost=NULL;
pgport=toto;
pgoption=NULL;
pgtty=NULL;
dbname="projet";
/*etablissement de la connection*/
conn=PQsetdb(pghost,pgport,pgoption,pgtty,dbname);
/*test de la connection a la bdd*/
if (PQstatus(conn)==CONNECTION_BAD)
{
printf("connection échouée");
printf("%s",PQerrorMessage(conn));
exit_nicely(conn);
}
exit_nicely(conn);
}
//command for compilation
gcc testpqlib.c -o testpqlib
//output errors of the compilator:
[magic(at)profs testsdivers]$ gcc testpqlib.c -o
testpqlib
/tmp/ccmMWakA.o: In function `exit_nicely':
/tmp/ccmMWakA.o(.text+0x8): undefined reference to
`PQfinish'
/tmp/ccmMWakA.o: In function `main':
/tmp/ccmMWakA.o(.text+0x88): undefined reference to
`PQsetdbLogin'
/tmp/ccmMWakA.o(.text+0x99): undefined reference to
`PQstatus'
/tmp/ccmMWakA.o(.text+0xb9): undefined reference to
`PQerrorMessage'
loic lecoeur
Caen (France)
___________________________________________________________
Do You Yahoo!?
Achetez, vendez! À votre prix! Sur http://encheres.yahoo.fr
From | Date | Subject | |
---|---|---|---|
Next Message | sayhello | 2000-02-04 08:24:43 | Save 50-80% on International Calls and Win $500 in Free phone calls |
Previous Message | offer | 2000-02-04 07:01:57 | Special Offer!! 50 Free Minutes! |