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


Access mysql through linked server error


Access mysql through linked server error

Author
Message
WangcChiKaBastar
WangcChiKaBastar
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 485
I have established a linked server to MYSQL to SQL Server Database
When I run this query I get error :

select * from mysql.brightlink.src_customers

Msg 7312, Level 16, State 1, Line 1
Invalid use of schema or catalog for OLE DB provider "MSDASQL" for linked server "mysql". A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog or schema.


however this works fine..

select * from openquery(MySql, 'select * from brightlink.src_customers')

I want to avoid using openquery as this is slow in production

please advise about four part naming convention from sql server to mysql
Lynn Pettis
Lynn Pettis
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38971 Visits: 38508
WangcChiKaBastar (3/26/2010)
I have established a linked server to MYSQL to SQL Server Database
When I run this query I get error :

select * from mysql.brightlink.src_customers

Msg 7312, Level 16, State 1, Line 1
Invalid use of schema or catalog for OLE DB provider "MSDASQL" for linked server "mysql". A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog or schema.


however this works fine..

select * from openquery(MySql, 'select * from brightlink.src_customers')

I want to avoid using openquery as this is slow in production

please advise about four part naming convention from sql server to mysql


select * from <yourlinkedservername>...<thetablename>

The ODBC driver should be convered to the database (catalog) your are accessing.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
WangcChiKaBastar
WangcChiKaBastar
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 485
ok I ran this as per your advise..

select * from MySQL...src_customers

and got this error ...


OLE DB provider "MSDASQL" for linked server "MySQL" returned message "Unspecified error".
OLE DB provider "MSDASQL" for linked server "MySQL" returned message "[MySQL][ODBC 5.1 Driver][mysqld-5.0.77]No database selected".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES" for OLE DB provider "MSDASQL" for linked server "MySQL". The provider supports the interface, but returns a failure code when it is used.



please advise if its possible to run create table and insert into statements from SQL Server to the linked MYSql server database ???
its urgent..thanks
Lynn Pettis
Lynn Pettis
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38971 Visits: 38508
I just checked our System DSN to the server running MySQL and it specifies the database to be accessed. How do you have your ODBC connection configured?

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
WangcChiKaBastar
WangcChiKaBastar
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 485
I have odbc connector installed (.net msi executable from web) and then created a dsn to mysql..

everything else works fine

my task is to fire sql code from sql server on to mysql database

logic will be

check if the table exists
if no then create the table
and then insert into the table select from sqlserver.dbo.table

I am looking into SSIS now with Script task...but doesnt look like its going to be starighforward plz advise
Lynn Pettis
Lynn Pettis
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38971 Visits: 38508
Here is a screen print of the ODBC config for our MySQL system. Is yours configured similarly?

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Attachments
MySQLConfig.rtf (112 views, 1.00 MB)
WangcChiKaBastar
WangcChiKaBastar
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 485
absolutely similar...

can I run something like select * into mysql...test1 from sqlserver.dbo.test
Paul White
Paul White
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15536 Visits: 11354
There is a complete step-by-step guide here:

http://www.ideaexcursion.com/2009/02/25/howto-setup-sql-server-linked-server-to-mysql/

Be sure to follow the steps exactly, especially the part concerning the MSDASQL provider properties ;-)



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
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