Re: Connection to Mysql database from C or C++ (114 Views)
Reply
Occasional Advisor
Posts: 9
Registered: ‎03-26-2004
Message 1 of 3 (114 Views)

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



Occasional Advisor
Posts: 15
Registered: ‎07-31-1997
Message 2 of 3 (114 Views)

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 !!

Highlighted
Occasional Advisor
Posts: 9
Registered: ‎03-26-2004
Message 3 of 3 (114 Views)

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
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.