Bug #4657 "Don't Cache Results" crashes when using catalog functions
Submitted: 20 Jul 2004 21:17 Modified: 6 Jun 2007 11:57
Reporter: Charlie Snyder Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.07 / 3.51.08 / 3.51.15 OS:Microsoft Windows (Windows XP)
Assigned to: Jim Winstead CPU Architecture:Any
Tags: ODBC5-RC

[20 Jul 2004 21:17] Charlie Snyder
Description:
Using MyODBC 3.51.07 or 3.51.08, when option 1048576 "Don't Cache Results (Only for forward-only cursor)" is selected MS Access crashes when establishing a DAO connection in a VB module.
Problem does not happen using MyODBC 3.51.06.
Problem does not happen using ADO.

Error Signature:
AppName: msaccess.exe	 AppVer: 10.0.4302.0	 ModName: myodbc3.dll
ModVer: 3.51.8.0	 Offset: 0000f4b5

Unhandled exception in MSACCESS.EXE (MYODBC3.DLL): 0xC0000005: Access Violation

How to repeat:
' In Access 2000/2002 DAO must be added and ADO removed from references:
'   Tools, References, De-Select Microsoft ActiveX Data Objects, Select Microsoft DAO 3.6 Object Library

'DSN-Less Connection String:
Const MySQLConnStr = "ODBC;driver={MySQL ODBC 3.51 Driver};DSN=;SERVER=localhost;database=MySQL;UID=;PWD=;OPTION=1048576;"

Sub MyODBCCrash()
Dim wsp As Workspace, conn As Connection
Set wsp = CreateWorkspace("tmpWorkspace", "", "", dbUseODBC)
'wsp.DefaultCursorDriver = dbUseNoCursor  'Firehose.  This does not fix the problem.
Set conn = wsp.OpenConnection("tmpConn", dbDriverComplete, True, MySQLConnStr) 'Changing ReadOnly to False does not fix the problem
MsgBox "Connected! Driver Version " & wsp.Connections("tmpConn").Database.Version
Set conn = Nothing: Set wsp = Nothing
End Sub
[22 Jul 2004 21:26] Miguel Solorzano
Verified with Access 2003.

Thank you for the bug report.
[24 Jan 2007 13:10] Bogdan Degtyariov
This happens due to the improperly initialized DBC* structure. It makes ADO referring to NULL pointer and causes the "Access Violation" error. As a workaround non-initialized fields can point to empty string buffers. However, the proper initialization is preferred.
[27 Apr 2007 17:10] Jim Winstead
Bug #25850 was marked as a duplicate of this bug.
[27 Apr 2007 17:38] Jim Winstead
A big note of clarification: "Don't cache results" and the catalog functions that make fake results sets are what crashes. Bug #22797 explains other problems of such fake results.
[15 May 2007 19:50] Jim Winstead
proof-of-concept of better handling "fake" result sets

Attachment: bug4657.patch (application/octet-stream, text), 9.30 KiB.

[16 May 2007 18:58] Jim Winstead
Fix crash when catalog result sets are being accessed

Attachment: bug4657.patch (application/octet-stream, text), 2.63 KiB.

[21 May 2007 6:18] Tonci Grgin
Bug#7758 was marked as duplicate of this one. Separate bug report for version 5 in Bug#28546.
[21 May 2007 18:15] Jim Winstead
The fix for this bug has been committed to the repository, and will be in the next release (3.51.16). Thanks for the bug report.
[6 Jun 2007 11:57] MC Brown
A note has been added to the 3.51.16 changelog.