Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Access mysql through linked server error Expand / Collapse
Author
Message
Posted Friday, March 26, 2010 10:23 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 2, 2014 11:14 AM
Points: 103, Visits: 450
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
Post #890825
Posted Friday, March 26, 2010 10:55 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:50 PM
Points: 23,003, Visits: 31,495
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.



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)
Post #890865
Posted Friday, March 26, 2010 12:37 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 2, 2014 11:14 AM
Points: 103, Visits: 450
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
Post #890990
Posted Friday, March 26, 2010 12:41 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:50 PM
Points: 23,003, Visits: 31,495
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?



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)
Post #890997
Posted Friday, March 26, 2010 1:04 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 2, 2014 11:14 AM
Points: 103, Visits: 450
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
Post #891013
Posted Friday, March 26, 2010 1:20 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:50 PM
Points: 23,003, Visits: 31,495
Here is a screen print of the ODBC config for our MySQL system. Is yours configured similarly?



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)


  Post Attachments 
MySQLConfig.rtf (35 views, 1.01 MB)
Post #891027
Posted Friday, March 26, 2010 2:00 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 2, 2014 11:14 AM
Points: 103, Visits: 450
absolutely similar...

can I run something like select * into mysql...test1 from sqlserver.dbo.test
Post #891071
Posted Friday, March 26, 2010 10:01 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:36 AM
Points: 11,192, Visits: 11,091
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
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #891233
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse