Bug #103696 Command is not yet supported
Submitted: 14 May 2021 8:15 Modified: 15 Jun 2021 12:09
Reporter: Jan Wilhelmi Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:>=8.0.24 OS:Windows
Assigned to: CPU Architecture:Any

[14 May 2021 8:15] Jan Wilhelmi
Description:
Version <= 8.0.23 OK
Version >= 8.0.24 Failure

SQLError: [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.24]This command is not yet supported in the prepared statement protocol

ALTER SCHEMA ProxessDB DEFAULT COLLATE utf8mb4_general_ci

How to repeat:
ALTER SCHEMA ProxessDB DEFAULT COLLATE utf8mb4_general_ci over ODBC Version >= 8.0.24
[14 May 2021 8:19] Jan Wilhelmi
Change Version
[14 May 2021 8:33] Jan Wilhelmi
In mySQL Workbench 8.0.24/8.0.25 with mySQL Server 8.0.24/8.0.25 does this command works.
[15 Jun 2021 12:09] Bogdan Degtyariov
Hi Jan,

I have not seen how exactly your application is running queries, but it seems that it is running SQLPrepare()/SQLExecute() sequence, which means that the statement should be first prepared then executed.
The driver gives error after SQLPrepare(), which is the expected behavior because the server does not support preparing ALTER SCHEMA statement.
You should use SQLExecDirect() function instead.

The older versions of ODBC driver would not prepare statements if the query did not contain any parameter markers.
So, SQLPrepare() call would not do anything. Then SQLExecute() did the direct query execution. That is why it worked for you.

However, it was undocumented behavior, which should not be used. Such things can change without warning.

This is not a bug, but an incorrect use of ODBC API. If your code does not intend to prepare a statement it must use SQLExecDirect() for executing queries without parameters.