connect to mysql database from c++ app
<p>am trying to connect to mysql database from my c++ program , i got success but the problem is with <code>libmysql.dll</code>
actually first program not run and give error that libmysql.dll is missing after that i copied libmysql.dll from my dev c folder and paste in the program folder after that it run successfully .</p>

<p>so this is problem that my program demanding for libmysql.dll always so any idea how to overcome with this problem or any other api which have no dependency on libmysqll.dll and i get connected to mysql database , because i cant sent two files to users with my program one libmysql.dll and my program.exe  .... so please help i want when i click my program it runs and connect to mysql to database , not demand for libmysql.dll file</p>

<pre><code>//connection params
    char *host = "localhost";
    char *user = "";
    char *pass = "";
    char *db = "";
    //sock
    MYSQL *sock;
    sock = mysql_init(0);
    if (sock) cout &lt;&lt; "sock handle ok!" &lt;&lt; endl;
    else {
         cout &lt;&lt; "sock handle failed!" &lt;&lt; mysql_error(sock) &lt;&lt; endl;
    }

    //connection
    if (mysql_real_connect(sock, host, user, pass, db, 0, NULL, 0))
         cout &lt;&lt; "connection ok!" &lt;&lt; endl;
    else {
         cout &lt;&lt; "connection fail: " &lt;&lt; mysql_error(sock) &lt;&lt; endl;
    }

    //connection character set
    cout &lt;&lt; "connection character set: " &lt;&lt; mysql_character_set_name(sock) &lt;&lt; endl;

    //wait for posibility to check system/mysql sockets
    system("PAUSE");

    //closing connection
    mysql_close(sock);
</code></pre>
