MySQL Forums
Forum List  »  Connector/C++

Program throws error 15
Posted by: Jeff Rosen
Date: March 04, 2014 07:19PM

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;
}

Options: ReplyQuote


Subject
Views
Written By
Posted
Program throws error 15
2631
March 04, 2014 07:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.