mysql_init() initialization problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chinmay Shah

    #1

    mysql_init() initialization problem

    hi,
    when i try to call the mysql_init function it is not getting initilized properly.
    can someone help me

    thanks
    chinmay
  • Chinmay Shah

    #2
    Re: mysql_real_conn ect() problem

    shahchinmay@gma il.com (Chinmay Shah) wrote in message news:<d9ef1350. 0503230645.724a a638@posting.go ogle.com>...[color=blue]
    > hi,
    > can someone help me pleaseeeeee?[/color]
    i am attempting to connect mysql server to win32 application... as far
    as initialization is concerned, it is successful but its showing some
    problem when i use mysql_real_conn ect..... have used different
    combinations to try and connect but all are unsuccessful... here is
    the code which i have written.... is there any mistake in the code...
    do let me know??????

    the code is:

    #include<winsoc k.h>
    #include<my_glo bal.h>
    #include<mysql. h>
    #include<window s.h>
    #include<window sx.h>

    void ConnectToMySql( )
    {
    MYSQL mysql;

    char *mysql_host = "localhost" ;
    char *mysql_user = "root";
    char *mysql_pass = "";
    char *mysql_db = "test";
    int mysql_port = 3306;
    int mysql_flag = 0;
    char *mysql_unix = NULL;

    //Allocates or initializes a MYSQL object
    if(mysql_init(& mysql))
    MessageBox(g_hW nd,"Initializat ion Successful","Te sting",0);
    else
    MessageBox(g_hW nd,"Initializat ion Not Successful","Te sting",0);

    //attempts to establish a connection to a MySQL database engine
    running on host
    if(!mysql_real_ connect
    (&mysql,MYSQL_H OST,MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB,MYSQL_ PORT,MYSQL_SOCK ET,MYSQL_FLAG))
    MessageBox(g_hW nd,"Connection 1 Not Successful","Te st",0);

    if(!mysql_real_ connect(&mysql, mysql_host,mysq l_user,mysql_pa ss,mysql_db,mys ql_port,mysql_u nix,mysql_flag) )
    MessageBox(g_hW nd,"Connection 2 Not Successful","Te st",0);

    if(!mysql_real_ connect(&mysql, "localhost","ro ot","","test",3 306,NULL,0))
    MessageBox(g_hW nd,"Connection 3 Not Successful","Te st",0);

    if(!mysql_real_ connect(&mysql, "localhost","", "","",0,NULL,0) )
    MessageBox(g_hW nd,"Connection 4 Not Successful","Te st",0);

    if(!mysql_real_ connect(&mysql, "localhost","ro ot","","test",0 ,NULL,0))
    MessageBox(g_hW nd,"Connection 5 Not Successful","Te st",0);

    if(!mysql_real_ connect(&mysql, "","","","",0,N ULL,0))
    MessageBox(g_hW nd,"Connection 6 Not Successful","Te st",0);

    if(!mysql_real_ connect(&mysql, "localhost","ro ot","","",0,NUL L,0))
    MessageBox(g_hW nd,"Connection 7 Not Successful","Te st",0);
    }[color=blue]
    >[/color]

    do let me at the earliest...
    [color=blue]
    > thanks
    > chinmay[/color]

    Comment

    Working...