Bug #116016 ERROR AL EJECUTAR EL COMANDO SHOW TABLES
Submitted: 6 Sep 3:48 Modified: 10 Oct 1:07
Reporter: DR SH Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.3 , 8.0 , 9.0 OS:Any
Assigned to: CPU Architecture:Any

[6 Sep 3:48] DR SH
Description:
Al conectarse mediante Connector/ODBC       

MySQL ODBC 3.51 Driver   
SHOW TABLES;     correctly returns database tables  OK

MySQL ODBC 5.3 Driver  ANSI
SHOW TABLES;     erroneously returns anything unknown  FALLA 

MySQL ODBC 8.0 Driver  ANSI
SHOW TABLES;     erroneously returns anything unknown  FALLA 

How to repeat:
When connecting to MYSQL 8.0 xxx through the ODBC 8.0.39 driver and executing the SHOW TABLES command, it always fails

Suggested fix:
el driver ODBC 8.0.39  es importante porque funciona en 32 Bit
[6 Sep 6:08] Bogdan Degtyariov
In order to diagnose the problem we need more context and details.

For instance, if you connect to MySQL server, but do not set the default database the "SHOW TABLES" query will return an error "No database selected". This is an expected behavior.

However, if the database name is specified during connection process and you still get an error it qualifies as a bug. I was not able to repeat this behavior with 32-bit version 8.0.37:

Full Connect(Default)

Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3
Successfully connected to DSN 'test'.
SQLExecDirect:
In:				Statementhandle = 0x0000000003692110, StatementText = "SHOW TABLES;", Statementlength = 12
				Return:	SQL_SUCCESS=0

Get Data All:
"Tables_in_test"
"tab1"
1 row fetched from 1 column.

We need answers to the following:

1. Was the database name specified on connect in DSN, Connection string, etc?

2. Does the error still happen if you provide the database name in DSN or "DATABASE=..." in the connection string?

3. How does it work if the query is like "SHOW TABLES FROM <db_name>" ?

4. Can you give us a test code, which helps to reproduce the bug?
[6 Sep 6:45] DR SH
Codigo en VSUAL FOX PRO 9

lcCnxStr = "Driver={MySQL ODBC 8.0 ANSI Driver};Port=3306;Server='208.109.247.97';Uid='expsanroman_soft';Pwd='123456';Database='db_ventas_soft';"

oConexion = SQLSTRINGCONNECT(lcCnxStr)

lnResult = SQLEXEC(oConexion, "SHOW TABLES")

OR 

lnResult = SQLEXEC(oConexion, "SHOW TABLES FROM db_ventas_soft")

and returns incorrect results, it does not return the names of the database tables
[6 Sep 7:03] Bogdan Degtyariov
Your connection string does not look correctly formatted:

Connection options are not supposed to be enclosed by single quotes

"Driver={MySQL ODBC 8.0 ANSI Driver};Port=3306;Server='208.109.247.97';Uid='expsanroman_soft';Pwd='*****';Database='db_ventas_soft';"

They should be like this:

"Driver={MySQL ODBC 8.0 ANSI Driver};Port=3306;Server=208.109.247.97;Uid=expsanroman_soft;Pwd=******;Database=db_ventas_soft;"

Otherwise the quote symbol becomes part of the name.

When you say this:

lnResult = SQLEXEC(oConexion, "SHOW TABLES FROM db_ventas_soft")

and returns incorrect results, it does not return the names of the database tables.

What are these incorrect results? Are they table names, but not the ones you expected?

Does it return an error? What is the error?
[6 Sep 8:50] DR SH
THE CONNECTION IS ESTABLISHED VERY WELL

When using the ODBC Driver 8.0.17 up to version 8.0.33 they work well and when I do a SELECT * FROM charges or SHOW TABLES query, they return the data and records correctly,,,,,,, but the ODBC drivers version 8.0.35 up to version 8.4.0 including 9.0 connect very well... but they interpret the data incorrectly and return the results incorrectly.
[6 Sep 9:20] Bogdan Degtyariov
Thanks for the reply, but you did not answer my questions.
I will try asking them differently:

1. does your program receive any errors from the driver? If yes, what are these errors (SQLSTATUS, Error Number, Error Message etc)?

2. When you say "correctly" or "incorrectly" it has very little bearing on this particular case and does not help to establish the root of the problem. What I need to know is something like "the expected result should be XXXXXX, but the driver gives us YYYYYY". Please provide more details on this.
[6 Sep 17:48] DR SH
The Driver, whatever the version, CONNECTS VERY WELL AND NO ERROR MESSAGES APPEAR.... UP TO THIS TIME ALL IS VERY WELL

BUT:

When I use the ODBC Driver 8.0.17 up to version 8.0.33 they connect correctly and then I query "SELECT * FROM cargos" the result is:
ID DESCRIPTION
--------------
01 Pilot
02 Copilot
03 Mechanic

When I use the ODBC Driver 8.0.35 up to version 9.0 they connect correctly and then I query "SELECT * FROM cargos" the result is:

ID  DESCRIPTION
---------------
va  -3
25  '
'   length
[6 Sep 17:53] DR SH
The Driver, whatever the version, CONNECTS VERY WELL AND NO ERROR MESSAGES APPEAR.... UP TO THIS TIME ALL IS VERY WELL

BUT:

When I use the ODBC Driver 8.0.17 up to version 8.0.33 they connect correctly and then I query "SHOW TABLES" the result is:

TABLES_IN_DB_VENTASSOFT
-----------------------
products
positions
brands
employees
orders

When I use the ODBC Driver 8.0.35 up to version 9.0 they connect correctly and then I query "SHOW TABLES" the result is:

TABLES_IN_DB_VENTASSOFT
-----------------------
varbinary      
-3
255
'
length
[10 Sep 1:04] Bogdan Degtyariov
Thanks for your reply.
The fragment of the incorrect data looks like a part of result set from SQLColumns() call, which is quite confusing.

Unfortunately, we are still unable to repeat the issue, which suggests that there might be something on your application side.

To investigate it further we need the ODBC trace logging every ODBC call the application is making. You will need to re-run your test with ODBC trace enabled.

Here are instructions on how to do it:

https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-configuration-trace.html

When the trace file is ready please attach it to this bug report.
Thanks.
[11 Oct 1:00] 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".