Bug #3084 vb-mysql application generates a serious error in Windows
Submitted: 6 Mar 2004 11:00 Modified: 31 May 2013 8:03
Reporter: Marlon Mendez Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[6 Mar 2004 11:00] Marlon Mendez
Description:
Hi I'm Marlon Mendez from Venezuela

The problem I'm experiencing is in the use of mysql with visual basic wich get me this error: "vb6.exe has generated errors and will be closed by Windows. A error log is being created. You must restart the program"

I'm using:

Server:
__________________________
-Windows 2000 Server (spanish)
-Version: 5.00.2195
-Service pack 4 (spanish)
-Processor: Intel Pentium, 1.70Ghz
-256 Mb RAM, 256Mb Kache
-40 Gb Hard Disc
-3 Partitions
-The server is a simple Domain controller
-myODBC 3.51 installed on it

mySQL server:
___________________________
-version: 4.0.16-nt
-Distribution:Binary
-Running: mysqld-nt.exe
-Installed in C:\ without any extra configuration in the .ini files
-Very simple installation

Clients:
___________________________
-Windows 2000 Professional, SP4 (spanish)
-MDAC_TYP 2.8 installed (spanish)
-Jet 4.0 SP8 installed (spanish)
-myODBC 3.51 installed on it

myODBC Connector:
___________________________
-Name: myProsawin
-User: root
-Port:3306
-System DSN
-Don't optimize column width
-Return matching rows
-A very simple ODBC Connection
-Good connection with the server

-Allow BIG Results (No matter the state, I get the error)
-Safety check (No matter the state the problem still, I get the error)

Visual Basic and my Project (Prosawin):(No matter the versions of libraries, I get the error)
___________________________
-Visual Basic 6.0, SP5
-DAO 3.51 Object library
-ADO 2.8 library
-Data Report Designer 6.0 (SP4)
-Data Environment Instance 1.0 (SP4)
-Data Formatting object library 6.0 (SP4)
-Data binding collection 6.0 (SP4)
-Data source interfaces
-ADO/DAO Connection string: "DSN=myProsaWin;"

Problem:
___________________________
-I'm using a data environment with 10 Commands defined
-All commands are SELECT statements
-All commands are clent sided
-All with default properties
-The project has 10 Data Reports bounded with the commands
-Just with some of these reports in run time and sometimes I get the error "vb6.exe has generated errors.." and VB shuts down
-The same way occurs when I generate the exe file of my app, but the error says "Prosawin.exe has generated error..." and shuts down

-This put an entry in the drwatson log file. I send attached the section referred to my app. (in spanish)
-I trace the error within the myodbc.log. The myodbc.log info is truncated (caused by the problem). I send attached the section referred to my app. Again, the last part of the myodbc.log is not truncated by me.

-The select query of the command is:
"SELECT CO_PAREN From ahp02 WHERE CO_PAREN = '01'"
-The datareport is a simple default data report
-The ahp02 table definition is:

CREATE TABLE `ahp02` (
  `CO_PAREN` char(2) NOT NULL default '',
  `DE_PAREN` char(15) default '',
  `DE_ABRPAR` char(2) default '',
  PRIMARY KEY  (`CO_PAREN`)
) TYPE=MyISAM

-When no data the error doesn't hit

-I've read the reference manual from top to bottom and tried ALL code variations and very good suggestions, I'm with this issue
from months ago, at this point I don't know what to do and my job is depending of this.

-Some friends told me it's a myODBC bug. I need some help!!

Regards!! men_mar@yahoo.com

How to repeat:
Create a project with this caracteristics and put some data in the table, execute the Data report and voilĂ 

Suggested fix:
Before A LOT of experimenting I would say that is a myODBC bug
[6 Mar 2004 11:02] Marlon Mendez
Dr Watson log and myodbc log files

Attachment: logs.zip (application/x-zip-compressed, text), 6.29 KiB.

[7 Mar 2004 10:38] Peter Harvey
Very simple VB test

Attachment: BUG-3084-01.zip (application/x-zip-compressed, text), 19.94 KiB.

[7 Mar 2004 10:46] Peter Harvey
I have created, and attached, BUG-3084-01 which seems to work fine for me. This test should be attempted by the customer. If this test fails for customer then please provide details. If this test does not fail but the customer is able to alter the test to provide an example then please provide altered test as attachment to bug.

NOTE: Customer will have to alter DSN, UID, and PWD properties in this test for it to work.
[8 Mar 2004 4:54] MySQL Verification Team
You should supply us with your configuration details to enable us to repeat a bug. 

Our ODBC team was not able to repeat it with your test case.
[9 Mar 2004 13:13] Marlon Mendez
Hi,
What do you mean with details?:
Hardware,ODBC Connector,Visual Basic Project

Hardware/Operating System:
-I get the error in all the machines with Win2000 SP4
-The Win 2000 and all other software is in Spanish
-In W98 machines I get a similar error
-The server is Win2000 Server SP4
-The clients are Win2000 Professional SP4
-With or without SP4 the error hits

-mySQL Server/ODBC Connector:
-All configurations with default values
-The ODBC connector has:
 * Version: 3.51.06
 * User: root
 * Port: 3306
 * Don't optimize column width: ON
 * Return matching rows: ON
 * Allow big results: ON
 * Safety check: ON
 * All other options: OFF

Visual Basic Project:
 - Visual Basic 6.0 with SP5 (error hits with or without service pack)
 - ADO Connection string: "DSN=myProsaWin;" (myProsawin: is the name of my DSN)
 - This connection string is used for the DataEnvironment and ADO connections
 - I use a dao ODBC direct connection:

   str_conn = "odbc;DSN=myProsaWin;DRIVER={MySQL ODBC 3.51 Driver};"
   Set wrkSpace = DBEngine.CreateWorkspace("", "", "", dbUseODBC)
   Set dao_ODBC = wrkSpace.OpenConnection("prosawin", dbDriverNoPrompt, False,  str_conn)

 - And a dao Jet connection:
 Set dao_JET = OpenDatabase("", dbDriverComplete, False, "ODBC;DSN=myProsaWin;")

 - I open DAO and ADO recordsets with forwardonly, dynaset and snapshot types
 - All ADO recordsets are client sided

 - Define a DataEnvironment with command pointing to several tables
 - The commands have LEFT JOIN, Count(),INNER JOIN, LIMIT
 - Several commands use parameters:
   SELECT fld1,fld FROM tbl WHERE fld1 = ?

 - Define DataReports bounded to the commands
 - No matter how you call the Datareports and pass the parameters, the error hits

I've installed Visual C++ 6.0 enterprise edition and the error is now more descriptive:

"Unhandled Exception in xxxxx.exe (NTDLL.DLL):0xC0000005: ACCESS VIOLATION"

and then opens VC++ and shows a lot of hexadecimal and assembler code

In W98 the error says that there was an error in the Kernel32.DLL.

The error appears:
- With the .exe application
- Call several times (20 or more) the Data reports
- When you close the app the error appears
- Sometimes after a lot of datareports calls I get a E_FAIL status error

I don't have datetimes fields with default values = 00/00/0000

Just execute datareports with command parameters a lot of times. I've tested everything and still getting this error.

Thanks in advance.
Regards.
[11 Mar 2004 14:28] Marlon Mendez
Hi, Now I have a more clear idea of what's going wrong:
When I execute a report, it creates a process in the server related to the connection wich the data report belongs. Of course there's just one connection defined for all the commands bounded to data reports. But executing reports after several times, I can see (with "show processlist") that the number of connections increase slowly and not proportional with the times I execute reports.
Then, in order to fix this, I tried to open/close the connection of the DataEnvironment through code, in this way

data_envrmt.Connections(1).Open "DSN=myProsaWin;OPTION=131078;STMT=;"

data_envrmt.my_command 'execute the command

If data_envrmt.rsmy_command.EOF And data_envrmt.rsmy_command.BOF Then
    MsgBox "No data", vbInformation
Else
    my_Rep.Refresh 
    my_Rep.Show vbModal 'show the report
End If

data_envrmt.Connections(1).Close

In this last line (closing the connection) occurs one of this things:
-The connection closes in the server
-The conection does not closes in the server
-The error hits!!!

I know this is not a support site, but I would like to know if this is a connection string issue, a myODBC issue or what (I'm thinking this is related to eternal Microsoft mistakes). PLease just try this and let me know.
Thanks a lot!!
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[31 May 2013 8:03] Bogdan Degtyariov
Thank you for your bug report. This issue has already been fixed in the release version of that product, which you can download at

  http://www.mysql.com/downloads/connector/odbc