Bug #92748 MySQL Connector/ODBC linked server issue with 5.3.11 Unicode Driver
Submitted: 11 Oct 2018 11:08 Modified: 11 Oct 2018 23:10
Reporter: A T Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.3.11 OS:Microsoft Windows
Assigned to: CPU Architecture:Any

[11 Oct 2018 11:08] A T
Description:
Consider this scenario:
1) You install MySQL Connector/ODBC 5.3 on a computer with Microsoft SQL Server;
2) You create a linked server connection to any MySQL server using this Connector/ODBC;
3) You confirm that test connection made successfully;
4) You try to execute any given SQL statement using OPENQUERY that contains newline in the beginning, for example:

SELECT * 
FROM OPENQUERY(MYSQL,'
	SELECT * FROM INFORMATION_SCHEMA.TABLES
')

In this case you will receive the following error:

Msg 7357, Level 16, State 2, Line 1
Cannot process the object "
	SELECT * FROM INFORMATION_SCHEMA.TABLES
". The OLE DB provider "MSDASQL" for linked server "MYSQL" indicates that either the object has no columns or the current user does not have permissions on that object.

How to repeat:
1) Install MySQL Connector/ODBC 5.3 on a computer with Microsoft SQL Server;
2) Create a linked server connection to any MySQL server using this Connector/ODBC;
3) Confirm that test connection made successfully;
4) Try to execute any given SQL statement using OPENQUERY that contains newline in the beginning, for example:

SELECT * 
FROM OPENQUERY(MYSQL,'
	SELECT * FROM INFORMATION_SCHEMA.TABLES
')

Ensure you receive an error message.

Eliminate newline at the beginning of the SQL statement:

SELECT * 
FROM OPENQUERY(MYSQL,'SELECT * FROM INFORMATION_SCHEMA.TABLES
')

Make sure that new query executes successfully.

Suggested fix:
Ignore new line at the beginning of the query. The issue did no exists in the previous versions of Connector/ODBC driver.
[11 Oct 2018 15:56] Miguel Solorzano
Result

Attachment: 92748.png (image/png, text), 107.41 KiB.

[11 Oct 2018 15:57] Miguel Solorzano
Thank you for the bug report. Please see prior attached screenshot.
[11 Oct 2018 18:19] A T
Can you please confirm that you have used version 5.3.11 to repeat?
[11 Oct 2018 23:10] Miguel Solorzano
Thank you for the feedback. I tested with 5.3.11 ANSI Driver, now testing with the 5.3.11 Unicode driver I got the error reported. Synopsis changed.