MySQL Forums
Forum List  »  Connector/C++

Access violation in my project, works in new project
Posted by: Alexander Kesarion
Date: April 08, 2013 06:03AM

My project compiles fine if I insert some code from the examples, but the program crashes with:
Unhandled exception at 0x552CEB8C (msvcr110d.dll) in comClient.exe: 0xC0000005: Access violation reading location 0x63697274.

If I use the EXACT same code in a new project it works just fine, does exactly what it's supposed to do.

Why isn't it working in my project?

Here's what I'm using:

try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;

/* Create a connection */
driver = get_driver_instance();
con = driver->connect("address:port", "user", "pass");
/* Connect to the MySQL test database */

stmt = con->createStatement();
stmt->execute("TRUNCATE TABLE words");

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;

Afer setting some breakpoints and using the debugger, it seems the crash happens on:
con = driver->connect("address:port", "user", "pass");

Obviously using a working address, user and pass.

Edited 2 time(s). Last edit at 04/08/2013 06:19AM by Alexander Kesarion.

Options: ReplyQuote

Written By
Access violation in my project, works in new project
April 08, 2013 06:03AM

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.