Friday, March 30, 2012

link to mysql

I tired to create a link 'MYSQL' in a SQL Server using the following code :

EXEC sp_addlinkedserver
@.server = mysql,
@.provider = 'MSDASQL',
@.provstr = 'DRIVER={MySQL ODBC 3.51 Driver};SERVER=MySQLServer;UID=root;PWD=;'

NB: I have a DB by the name of : MYSQL

There is no errors during creation ...

The link creation is OK but I am not able to see tables from SQL Server

Any Idea ?Linked server login mappings can be added using sp_addlinkedsrvlogin and refer to books online for more information.|||No it ok for the link creation but we have the following error :

Msg 7314, Niveau 16, tat 1, Ligne 1

when execution :

select * from mysql...host

any idea ?|||When setting up the linked server you need to map your local login to appropirate remote/destination server's login.|||The mapping is OK ? really, I don't inerstant the pb ?
Did you try to to this with a MYSQL DB ?|||You shoudl use OPENQUERY method to access the data.

However, the openquery() method ALWAYS worked while the suggested method of SERVER.CATALOG.OWNER.TABLE will have some issues.

Ensure you've MyODBC installed properly on SQL server.
I don't have any issues in using MySQL as LS.|||Could you please give us an example (with MySQL Server)

Could you tell us what is :

SERVER under MySQL
CATALOG under MySQL
OWNER under MySQL

Could you give us a query example with a table from the default Mysql DB.

Indeed, I successed to have a resultat when using OPENQUERY :

But it doesn't work every time (it depends of the row nb in the table I think).

So it is OK for :

SELECT * FROM OPENQUERY (mysql,'SELECT * FROM db where 1=2')

But not for :

SELECT * FROM OPENQUERY (mysql,'SELECT * FROM db)

Error : Msg 7347

Help !!!!!!!

No comments:

Post a Comment