Operating System - HP-UX
1753578 Members
6238 Online
108796 Solutions
New Discussion юеВ

Connection to Mysql database from C or C++

 
Vinay_19
Occasional Advisor

Connection to Mysql database from C or C++

Hi,

Has anyone tried connecting to Mysql database from C or C++. I have the code I am not sure how to make it work. Compile and execute.

I am on HP-UX 11.23i ,rx2600, 64 bit machine Itanium processor.


Any help appreciated.

Thank you,
Vinay



2 REPLIES 2
Werner Ittner
Occasional Advisor

Re: Connection to Mysql database from C or C++

Hi,

for me MySQL would be worthless without C interface.

I didn't test it with HPUX until now, but this works fine with LINUX :


CFG=/usr/bin/mysql_config
sh -c "gcc -o Prog.r '$CFG --cflags' Prog.c '$CFG --libs'"

where Prog.c is your source code.


Unfortunatley there is no precomiler in MySQL, yet (only experimental). So you must use c-libs in your code.
But speed is very nice !!

Vinay_19
Occasional Advisor

Re: Connection to Mysql database from C or C++

Werner,

I get the following error with the command.

$ sh "cc -o testmy `mysql_config --cflags` testmy.c `mysql_config --libs`"

ld: Can't find library or mismatched ABI for -lmysqlclient
Fatal error.


Is there anything wrong with thge library.

Thank You,
Vinay