Monday, March 12, 2012

How to create a linked server to MySQL from MsSQL?

I can create a linked server to another MsSQL from MsSQL,but encounter error when create a linked server to MySQL:
Error 7399:OLE DB provider 'MSDASQL' reported an error.
Data source name not found and no default driver specified.
.....
Anyone can help me?
Thanks!try this step,

1. Installed MyODBC driver version for windows,u can download from mysql site
2. Create a system ODBC DSN using this driver to a specific server and database.

3. In SQL Server 2K Enterprise Manager, created a linked server using Microsoft OLE DB Provider for ODBC Drivers and specified the DSN in the Data Source.

and select query should be,

SELECT * FROM OPENQUERY(linkedservername, 'database.table')

or

SELECT * FROM OPENQUERY(linkedservername, 'select * from table)

--cheers,
--http://mallier.blogspot.com|||Yes,I did as you said.But still get this error.

The setting are:
Server Type:Microsoft OLE DB Provider for ODBC
DataSource:mydsn
Provider string:DATABASE=mydb;DSN=mydsn;SERVER=myserver;UID =myuid;PWD=mypwd
Location:myserver
Catalog:mydb

Something is wrong?|||I dont have Mysql here,
try this,

Server Type:Microsoft OLE DB Provider for ODBC
DataSource:mydsn

and remove other properties.

--cheers,
--http://mallier.blogspot.com|||Even I linked to the MsSQL server NOT MySQL,
if put myserver in data source,it's ok.
but if put mydsn in data source,it got same error.|||Sorry,I created dns in wrong location.
After I corrected this mistake,linking to MsSQL is ok,but encountered not responding when link to MySQL.(I've verified that the dsn is ok.)|||I've fixed this problem,it's due to I didn't enable root access from remote machines.
Thanks.

No comments:

Post a Comment