-
how to reach MySQL??
hi everybody,
I have linux box, installed RedHat9, MySQL3.23.54, and gcc.
I want to reach MySQL database server, in C program .
So MySQL-devel also installed, and MySQL header files(mysql.h, mysql_version.h, mysql_com.h) seems under /usr/include/mysql)
but the when I compile the c program gives so many parse error refers to mysql.h and also says it could not found my_alloc.h..that mkes me grief as you guessed.
I wonder if anyone send me simple program that uses Mysql and explicit assertion how to use and configure MySQL header files and libraries. or is there any document expreses this matter in any dark room of the net??
any helps are apreciated.
best regards.
//metin
__________________
-
I just did a search on google for MySql, and it came back with a site called www.MySql.com. This site has manuals for connecting to MySql databases using an ODBC connector. It only took me two minutes to find all of this. You should really try having a look for yourself first you know.
-
hi
most probably you are forgetting to use "-lmysqlclient" option to compile your program. (I assume that your mysql library files are located under the default directory for GCC)
here is a simple code for mysql
Code:
#include <stdio.h>
#include <mysql/mysql.h>
MYSQL sql;
int main()
{
if (mysql_connect(&sql,"your_hostname","username","passwd"))
{
printf("OK\n");
mysql_close(&sql);
}
else
{
fprintf(stderr,"Zong!!");
exit(1);
}
return 0;
}
and finally, "sanýrým turkiye'densin ;) "
Kolay gelsin....