Bug #83824 Random output parameters from a (local) MySQL server 5.7.16 with ADODB
Submitted: 15 Nov 2016 10:12 Modified: 15 Nov 2016 13:34
Reporter: Arnoud Klaren Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.3.6 OS:Windows (10.0.14393 64-bit)
Assigned to: CPU Architecture:Any
Tags: ADODB, ODBC, output parameters

[15 Nov 2016 10:12] Arnoud Klaren
Description:
MySQL ODBC connector 5.3.6 returns random values for the output parameters of stored procedures on a (local) MySQL Server 5.7.16 (64-bit) in combination with a MS Access 2016 database application (32-bit) and ADODB.

The problem disappears when I:
- connect to a remote MySQL server 5.6.22 (64-bit) on a Windows 7 (64-bit) computer;
- retrieve the output parameters using a .NET application (64-bit) and the MySQL .NET connector;
- downgrade to the MySQL ODBC 5.3.4 connector.

How to repeat:
Set up the following environment:
- Windows 10 Pro (64-bit)
- Microsoft Office 2016 ProPlus (32-bit)
- MySQL Community Server 5.7.16 (64-bit)
- MySQL ODBC/Connector 5.3.6 (32-bit)

Stored procedure on MySQL server:

CREATE PROCEDURE `testit`(
    OUT iTest INT(11))
BEGIN
    SET iTest = 123;
END

MS Access database containing only the following VBA code (and a reference to the Microsoft ActiveX Data Objects 6.1 library):

Public Function dbTestIt() As Long

Dim dbConn As ADODB.Connection
Dim dbCmd As ADODB.Command

    'Open new connection
    Set dbConn = New ADODB.Connection
    dbConn.ConnectionString = "Driver={MySQL ODBC 5.3 Ansi Driver};option=3;database=xxx;user=root;password=yyy;"
    dbConn.Open

    'Execute new command
    Set dbCmd = New ADODB.Command
    With dbCmd
        Set .ActiveConnection = dbConn
        .CommandTimeout = 0
        .CommandType = adCmdStoredProc
        .CommandText = "testit"
        .Parameters.Append dbCmd.CreateParameter("iTest", adInteger, adParamOutput)
        .Execute
        dbTestIt = dbCmd.Parameters.Item(0).Value
    End With

    'Close Connection
    dbConn.Close

End Function

I also tried it with a varchar as output parameter.

The full case is described on http://stackoverflow.com/questions/40531411/output-parameter-of-mysql-stored-procedures-vi....

Suggested fix:
?
[15 Nov 2016 13:08] Chiranjeevi Battula
Hello Arnoud Klaren,

Thank you for the bug report.
This is most likely duplicate of Bug #83698, please see Bug #83698.

Thanks,
Chiranjeevi.
[15 Nov 2016 13:34] Arnoud Klaren
I guess you are right. I did search for "output parameter" in ODBC connector bug reports, but only found bug reports of more than 1.5 years ago, because #83698 only contained the words "out parameter" :(

One piece of extra information that might be helpful is that, when connecting to a remote MySQL server 5.6.22 (64-bit) on a Windows 7 (64-bit) computer, the problem disappeared. I hope that helps.