Connection Crash in mysql C++ -
currently, have implemented program write mysql database... using xcode c++as well. have imported libraries correctly i'm getting bad excess error message on line :
con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
what seems issue? heres full program...
#include <stdlib.h> #include <iostream> // include directly different // headers cppconn/ , mysql_driver.h + mysql_util.h // (and mysql_connection.h). reduce build time! #include "mysql_connection.h" #include <cppconn/driver.h> #include <cppconn/exception.h> #include <cppconn/resultset.h> #include <cppconn/statement.h> using namespace std; int main(void) { cout << endl; cout << "running 'select 'hello world!' _message'..." << endl; try { sql::driver *driver; sql::connection *con; sql::statement *stmt; sql::resultset *res; // create connection driver = get_driver_instance(); con = driver->connect("tcp://127.0.0.1:3306", "root", "root"); // connect mysql test database con->setschema("test"); stmt = con->createstatement(); res = stmt->executequery("select 'hello world!' _message"); while (res->next()) { cout << "\t... mysql replies: "; // access column data alias or column name cout << res->getstring("_message") << endl; cout << "\t... mysql says again: "; // access column fata numeric offset, 1 first column cout << res->getstring(1) << endl; } delete res; delete stmt; delete con; } catch (sql::sqlexception &e) { cout << "# err: sqlexception in " << __file__; cout << "(" << __function__ << ") on line " << __line__ << endl; cout << "# err: " << e.what(); cout << " (mysql error code: " << e.geterrorcode(); cout << ", sqlstate: " << e.getsqlstate() << " )" << endl; } cout << endl; return exit_success; }
edit currently, looked @ topic similar mine still lost... how recompile mysql cmake , change such flags?
i have been @ issue several hours , no coding has been done... staring @ screen face >:(.
here's similar problem (almost identical?), have checked it?
Comments
Post a Comment