Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-244

Microsoft Excel 365 ODBC Navigator can't find tables

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 3.0.8
    • Fix Version/s: 3.0.9, 3.1.1
    • Component/s: General
    • Labels:
      None

      Description

      I'm using Microsoft Excel 365 version 1903 on Windows 10. When I try to import a table into an Excel spreadsheet with MariaDB Connector/ODBC 3.0.8, Excel can't actually seem to find any tables.

      When I look at the general query log on the backend server, The ODBC connector seems to be executing the following query:

                        356 Prepare   SELECT SCHEMA_NAME AS TABLE_CAT, CONVERT(NULL,CHAR(64)) AS TABLE_SCHEM, CONVERT(NULL,CHAR(64)) AS TABLE_NAME, NULL AS TABLE_TYPE, NULL AS REMARKS FROM INFORMATION_SCHEMA.SCHEMATA GROUP BY SCHEMA_NAME ORDER BY SCHEMA_NAME
                        356 Execute   SELECT SCHEMA_NAME AS TABLE_CAT, CONVERT(NULL,CHAR(64)) AS TABLE_SCHEM, CONVERT(NULL,CHAR(64)) AS TABLE_NAME, NULL AS TABLE_TYPE, NULL AS REMARKS FROM INFORMATION_SCHEMA.SCHEMATA GROUP BY SCHEMA_NAME ORDER BY SCHEMA_NAME
                        356 Close stmt
      

      It makes sense that Microsoft Excel can't find the tables because TABLE_NAME seems to be NULL in the output of this query.

      It is strange that MariaDB Connector/ODBC is querying information_schema.SCHEMATA if Microsoft Excel wants the names of available tables. It should probably query information_schema.TABLES instead.

      I enabled Tracing in Windows ODBC Data Source Administrator to see what function Microsoft Excel is calling, and it seems to be calling SQLTablesW:

      Microsoft.Mashu d68-4d48	ENTER SQLTablesW 
      		HSTMT               0x0263DD18
      		WCHAR *             0x02EF809C [       1] "%"
      		SWORD                        1 
      		WCHAR *             0x00000000 <null pointer>
      		SWORD                        0 
      		WCHAR *             0x00000000 <null pointer>
      		SWORD                        0 
      		WCHAR *             0x030A01A4 [      10] "TABLE,VIEW"
      		SWORD                       10 
       
      Microsoft.Mashu d68-4d48	EXIT  SQLTablesW  with return code 0 (SQL_SUCCESS)
      		HSTMT               0x0263DD18
      		WCHAR *             0x02EF809C [       1] "%"
      		SWORD                        1 
      		WCHAR *             0x00000000 <null pointer>
      		SWORD                        0 
      		WCHAR *             0x00000000 <null pointer>
      		SWORD                        0 
      		WCHAR *             0x030A01A4 [      10] "TABLE,VIEW"
      		SWORD                       10 
      

      Which seems to be a variant of SQLTables:

      https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqltables-function?view=sql-server-2017

      This function seems to be defined here:

      https://github.com/MariaDB/mariadb-connector-odbc/blob/3.0.8/odbc_3_api.c#L3164

      And it looks like it might indirectly call this function:

      https://github.com/MariaDB/mariadb-connector-odbc/blob/3.0.8/ma_statement.c#L3332

      It looks like the bug might be here:

      https://github.com/MariaDB/mariadb-connector-odbc/blob/3.0.8/ma_statement.c#L3368

      Shouldn't this actually be the following?:

      if (CatalogName && NameLength1 && !NameLength3 && !strcmp(CatalogName, SQL_ALL_CATALOGS ))
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Lawrin Lawrin Novitsky
              Reporter:
              GeoffMontee Geoff Montee
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.