How to Connect live database in c++ by using codeblocks

144 views Asked by At
#include <iostream>
#include<mysql.h>

using namespace std;

int main()
{
    MYSQL* conn;
    conn = mysql_init(0);
    conn = mysql_real_connect(conn,"sql12.freemysqlhosting.net","sql123893..","nYES4ifTZ1","sql123893..", 0, NULL, 0);
    if(conn){
        cout<<"Connected";
    }
    else{
        cout<<"Not Connected";
    }
    return 0;
}

I am trying to connect live database in my cpp application But it not connecting please anyone give example to connect live database in cpp in codeblocks

0

There are 0 answers