SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Linked Server (MYSQL) links ok, but cannot see tables and queries return errors


Linked Server (MYSQL) links ok, but cannot see tables and queries return errors

Author
Message
mariann harper
mariann harper
SSC-Enthusiastic
SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)

Group: General Forum Members
Points: 105 Visits: 215
I followed the steps in this article and successfully got a Linked Server on SSMS.
http://www.ideaexcursion.com/2009/02/25/howto-setup-sql-server-linked-server-to-mysql/

The database is there, but no tables are visible. Aren't I supposed to be able to view the tables, just like regular SQL Server tables can be viewed? None are listed.
----------------------
I also ran some code manually to get info on a table:

SELECT * FROM OPENQUERY (MYSQL, 'SELECT * FROM Mytable')

and got this error:

An unexpected NULL value was returned for column "[MSDASQL].checked_out_time"
from OLE DB provider "MSDASQL" for linked server "MYSQL". This column cannot be NULL.Hehe
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39794 Visits: 14412
mariann harper (5/17/2011)
I followed the steps in this article and successfully got a Linked Server on SSMS.
http://www.ideaexcursion.com/2009/02/25/howto-setup-sql-server-linked-server-to-mysql/

The database is there, but no tables are visible. Aren't I supposed to be able to view the tables, just like regular SQL Server tables can be viewed? None are listed.

----------------------
I also ran some code manually to get info on a table:

SELECT * FROM OPENQUERY (MYSQL, 'SELECT * FROM Mytable')

and got this error:

An unexpected NULL value was returned for column "[MSDASQL].checked_out_time"
from OLE DB provider "MSDASQL" for linked server "MYSQL". This column cannot be NULL.Hehe

Both issues are likely due to the fact that the version of MySQL database your connecting to does not contain an implementation of INFORMATION_SCHEMA consistent with ISO standards. It could also be a driver issue.

What version of MySQL are you connecting to? What version of the MySQL ODBC driver are you using?

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
mariann harper
mariann harper
SSC-Enthusiastic
SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)

Group: General Forum Members
Points: 105 Visits: 215
I'm not sure what version of MYSQL it is, as it's coming from an external website.

I'm using the MySQL ODBC 5.1 driver.
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39794 Visits: 14412
What does this return when executed on your SQL Server?

EXEC('SHOW VARIABLES LIKE "%version%";') AT [MYSQL];



__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
mariann harper
mariann harper
SSC-Enthusiastic
SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)

Group: General Forum Members
Points: 105 Visits: 215
Variable_name Value

innodb_version 1.0.13
protocol_version 10
version 5.1.52
version_comment MySQL Community Server (GPL)
version_compile_machine i686
version_compile_os pc-linux-gnu
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39794 Visits: 14412
Thanks. You won't be able to browse your complete MySQL object hierarchy through the SSMS Linked Server node for the reason I mentioned in my previous post about them not coding up to ISO standards but you should be able to pull data. I think all you need to do is start qualifying your table names, like this:

SELECT * FROM OPENQUERY (MYSQL, 'SELECT * FROM SchemaName.Mytable')



__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
mariann harper
mariann harper
SSC-Enthusiastic
SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)

Group: General Forum Members
Points: 105 Visits: 215
Thanks for your reply.

Unfortunately, I get another error:

Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "MSDASQL" for linked server 'MYSQL'.

Could it be a permissions issue from the website's MySQL setup?
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39794 Visits: 14412
It's possible that SQL Server is trying to use INFORMATION_SCHEMA on the MySQL to expand the * to an explicit column list under the covers and it's failing due to the lack of an ISO standard INFORMATION_SCHEMA. Try replacing "SELECT *" in your query with an explicit column list. Please post your exact query in your next post if you continue to have issues.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
mariann harper
mariann harper
SSC-Enthusiastic
SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)SSC-Enthusiastic (105 reputation)

Group: General Forum Members
Points: 105 Visits: 215
I'd try that, but cannot look at the table to find the columns, lol. It's a catch-22.
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39794 Visits: 14412
You can try retrieving the column names from INFORMATION_SCHEMA like this:

EXEC ('SELECT  TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = ''MyTable''
AND TABLE_SCHEMA = ''SchemaName'' ;') AT [MYSQL] ;



__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search