how to reach MySQL??

This is a discussion on how to reach MySQL?? within the C Programming forums, part of the General Programming Boards category; hi everybody, I have linux box, installed RedHat9, MySQL3.23.54, and gcc. I want to reach MySQL database server, in C ...

  1. #1
    Registered User mergoktas's Avatar
    Join Date
    Sep 2003
    Posts
    2

    Question 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


    __________________

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    98
    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.
    There is no such thing as a humble opinion

  3. #3
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    269
    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....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MySQL libraries
    By csonx_p in forum C++ Programming
    Replies: 6
    Last Post: 10-02-2008, 03:23 AM
  2. About C++ and MySQL or oether free database
    By xxxrugby in forum C++ Programming
    Replies: 18
    Last Post: 12-30-2005, 06:28 AM
  3. NAQ: Everything you never wanted to know about CPP
    By evildave in forum C Programming
    Replies: 21
    Last Post: 12-12-2005, 10:56 AM
  4. Get data from mysql and use in a system.
    By smaakage in forum Tech Board
    Replies: 3
    Last Post: 10-04-2005, 01:03 PM
  5. Get data from mysql and use in a system.
    By smaakage in forum C++ Programming
    Replies: 5
    Last Post: 10-02-2005, 02:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21