Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Program throws error 15 (no replies)

$
0
0
This simple code throws error 15? What does that mean? I can't find the error codes documented anywhere. It's strange because the data gets inserted into the table then throws the exception afterwards.


#include <stdlib.h>
#include <iostream>

/*
Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your 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)
{
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;

/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "1092Wilda");
/* Connect to the MySQL test database */
con->setSchema("test");

stmt = con->createStatement();
res = stmt->executeQuery("INSERT INTO bung VALUES ('39', 'TestVal')");
delete res;
delete stmt;
delete con;

} catch (sql::SQLException &e) {
cout << e.getErrorCode();
}

cout << endl;

return EXIT_SUCCESS;
}

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>