Bug #65311 Using CRecordSet.Open() gives an Access Violation in MyODBC5.dll
Submitted: 14 May 2012 15:26 Modified: 17 May 2012 9:54
Reporter: Tom Akerman Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1.11 OS:Windows (XP)
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[14 May 2012 15:26] Tom Akerman
Description:
I have been running a MySQL Server for years and have recently been forced to upgrade to a newer version (now MySQL Community Server 5.1.57 running on Linux SuSe 11.4). This also meant upgrading the ODBC Connector from 3.51 to 5.1.11.

I now have issues with code in MFC apps that has been running fine for years. The problem comes with CRecordSet.Open() and generates an "Access Violation reading location 0x00030000". Looking at the stack this seems to be something to do with myodbc5.dll not my code as the stack frame reads "myodbc5.dll!019ee257()"

The weird thing is that by this point in the code I have already accessed the database and in fact this table several times by exactly the same method. 

Also if I remove this function it will fail on the next CRecordSet.Open() which relates to a different table in the database.

How to repeat:
Short of sending you a huge database and program I would suggest constructing a program that uses CRecordSet and opens connections to different tables and keep it going until it fails.

Suggested fix:
Having Read about on the internet you seem to have similar issues with almost every release, so I'm sure you can sort it out.
[15 May 2012 10:07] Bogdan Degtyariov
Tom,

we are not looking forward to getting a huge database and heaps of sources.
The test case should be as small as possible.
Did I get it right that I just have to open and close CRecordSet instance?
In my test case it never failed...
[15 May 2012 10:30] Tom Akerman
I don't understand it myself, we have an almost identical program that works fine but this one with very simple record sets fails. The weird thing is that if I remove the call that it fails on it then fails on the next .Open() which is about the fifth or sixth in the program. I'm now not 100% that it is the connector. I will update this case later based on my findings.
[15 May 2012 14:52] Tom Akerman
Just as a further aside, I'm using and extremely old version of Visual Studio (2002) which uses mfc70.dll. Is there perhaps some conflict between mfc70.dll and myodbc5.dll? Just thinking aloud really. I'm currently installing VS 2010 to see if that helps.
[17 May 2012 7:58] Tom Akerman
OK, i've now source the issue and it isn't a bug. Feel free to close this case. Sorry to have been a pain.
[17 May 2012 9:54] Bogdan Degtyariov
Tom, thanks for the update.
With ODBC programming it is not always possible to determine the true reason of 
the problem at once... Too many components from different software get involved.
Closing the report.