我有第二个问题C ++& Mysql的, 应用程序符合正确,但当我尝试这个时,我有这样的消息:
root@raspberrypi:/home/pi/elementari/base# ./appkconnectalpha
terminate called after throwing an instance of 'sql::MethodNotImplementedException' appkconnectalpha main.cpp -L/usr/lib -lmysqlcppconn
what(): MySQL_Connection::setReadOnly()
Aborted
代码是:
#include <iostream>
#include <stdlib.h>
#include <mysql_connection.h>
#include <mysql_driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
using namespace std;
int main(void){
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306","********","***********");
con->setSchema("Elem_elems");
stmt = con->createStatement();
delete stmt;
delete con;
return 0;
}