MFC Access Violation
November 25, 2006 3:26 PM
Subscribe
Why does executing a SQL query via MFC's CDatabase class always result in an access violation?
I log data to a remote MySQL database via MySQL Connector/ODBC 3.51. Every time I call CDatabase::ExecuteSQL(), I get an access violation logged to Visual Studio's debug window:
First-chance exception at 0x7c809eb2 in DBTester.exe: 0xC0000005: Access violation reading location 0x00000005.
The deepest I can trace is CDatabase::OnSetOptions(), when it calls SQLSetStmtOption() on SQL_QUERY_TIMEOUT. The comment above that call says "Ignore failure." Unfortunately, the failure is not ignored. I get a debug message every time that line is executed despite the try block around CDatabase.ExecuteSQL(). The data is successfully logged to the database, but the error is polluting my output window, makeing it much harder to debug more important issues.
1. Is there a way to fix the error?
2. If not, can I make it go away somehow?
posted by b1tr0t to computers & internet (12 comments total)
posted by sfenders at 5:27 PM on November 25, 2006