Bug #68280 ODBC 5.2(w) Driver; Commands out of sync; you can't run this command now
Submitted: 5 Feb 2013 22:25 Modified: 15 Feb 2013 17:23
Reporter: Sebastian Mass Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.2.4 OS:Windows
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: ODBC 5.2(w) Driver

[5 Feb 2013 22:25] Sebastian Mass
Description:
Dim rst As Recordset
Set rst = New Recordset
rst.Open "CALL getStockByProductoIDDepId( "12658" ,"1");", adoConn,adOpenKeyset,adLockOptimistic

 Dim Comm As Command
 Set Comm = New Command
 Comm.ActiveConnection = adoConn
 Comm.CommandText = strcomand
 Comm.CommandType = adCmdStoredProc
 Comm.Parameters.Append Comm.CreateParameter("prodid", adInteger, adParamInput, , ProducID)
 Comm.Parameters.Append Comm.CreateParameter("catid", adInteger, adParamInput, , IdLista)
Comm.Execute

ODBC 5.2(w) Driver; Commands out of sync; you can't run this command now

NOTE: Not occur with the version MySQL ODBC 5.1 Driver

How to repeat:
Dim rst As Recordset
Set rst = New Recordset
rst.Open "CALL getStockByProductoIDDepId( "12658" ,"1");", adoConn,adOpenKeyset,adLockOptimistic

 Dim Comm As Command
 Set Comm = New Command
 Comm.ActiveConnection = adoConn
 Comm.CommandText = strcomand
 Comm.CommandType = adCmdStoredProc
 Comm.Parameters.Append Comm.CreateParameter("prodid", adInteger, adParamInput, , ProducID)
 Comm.Parameters.Append Comm.CreateParameter("catid", adInteger, adParamInput, , IdLista)
Comm.Execute

ODBC 5.2(w) Driver; Commands out of sync; you can't run this command now
[7 Feb 2013 6:56] Bogdan Degtyariov
Sebastian,

This is the expected behavior of Connector/ODBC (as well as any other MySQL Connector) because MySQL network protocol does not allow clients to run another query or command before receiving all results from the previous one.

In your case you opened a recordset, which means that on the server side a query was executed and the server prepared to stream results back to the client. 

You have to go through all rows in the recordset and close it before running any other command or opening another record set.

It is also possible to open another connection, which does not interfere in any way with the current connection. Note that concurrent connections have independent threads on the server and therefore can run queries and get results independent from each other.

Setting the status "Not a bug".
[15 Feb 2013 17:23] Sebastian Mass
Bogdan Degtyariov;
Thanks for your reply.
Why not get an error when I change the driver version?
NOTE: Not occur with the version MySQL ODBC 5.1 Driver

thanks