0

I have SQL Server 2008 SP4 instance accessing a linked server that is running a MediaWiki database on MariaDB (v 5.5.44). I am able to select from the table no problem:

SELECT *
FROM OPENQUERY(MEDIAWIKI,
'SELECT * FROM wiki.page WHERE page_title = ''Test''')

But when I try to update the table:

UPDATE OPENQUERY(MEDIAWIKI,
'SELECT * FROM wiki.page WHERE page_title = ''Test''')
SET page_title = 'TestChange'

I get the following error message:

OLE DB provider "MSDASQL" for linked server "MEDIAWIKI" returned message "Table 'def.page' doesn't exist".
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "MEDIAWIKI" could not UPDATE table "[MSDASQL]". 

The user has full permissions, so that shouldn't be an issue. I'm also able to make updates against other linked servers running MySQL. Any help is hugely appreciated. Thanks!

EDIT: I am able to get around this by building a dynamic query string and executing it at the linked server, mostly just curious as to why this is happening at this point.

2 Answers 2

2

I second Vladislav here. 'def' is used as catalog value(if you look in columns metadata returned by server, or in INFORMATION_SCHEMA tables 'TABLES' or 'COLUMNS'. Both MySQL and MariaDB connectors return table's schema as catalog, and NULL as schema.

It must be that MariaDB Connector/ODBC has but and returns 'def' somewhere in metadata as schema(or catalog?). What version do you use? In fact it could be fixed in latest version. But please better proceed in the JIRA issue created by Vladislav

1
  • Looks like I am a little behind, I'm using 1.0.5.1. I'll update it and see if that works! I also confirmed that using the MySQL driver allows the update to work properly - so this is definitely a bug with the MariaDB driver.
    – chazbot7
    Jan 23, 2017 at 16:07
1

What kind of ODBC driver do you use? There are 2, MariaDB one, and MySQL one. This looks like a bug in one of these ODBC. Now what does "def" mean. There is a great amount of confusion in MySQL world about catalog, database and schema. MySQL result sets are returned with metadata (column info description). Column info contains several fields, among them "table catalog" (always hardcoded "def") , and also "table schema", aka database. Catalog does not have any meaning currently, and never had, but who knows maybe it could mean something in the future. "schema" on the other hand, is something that you can put into UPDATE command ( UPDATE schema.table SET field=value WHERE ...) . So the bugs seems to be is that one of the ODBC drivers incorrectly chooses "catalog" over "schema".

3
  • I'm using the MariaDB ODBC driver. Which one has the bug?
    – chazbot7
    Jan 20, 2017 at 16:32
  • 1
    The one you're using :) I filed a bug about this here jira.mariadb.org/browse/ODBC-80 . Feel free to chime in with more details or just to subscribe to the bug updates to stay informed. You can use MySQL's ODBC connector in the meantime, until it is fixed Jan 20, 2017 at 18:08
  • Yep, the MySQL driver totally works. I'll try updating my MariaDB driver and see if that helps, but the MySQL one will definitely work for now. Thanks!
    – chazbot7
    Jan 23, 2017 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.