10

Is it possible create/configure MySQL for functionality like SQL Server's Linked Server?

If yes, would you please tell me how? I'm using MySQL 5.5.

4 Answers 4

13

MySQL's FEDERATED engine provides functionality similar to SQL Server's Linked Server (and Oracle's dblink) functionality, but doesn't support connecting to vendors other than MySQL. It's not clear from the question if you need the functionality to connect to vendors other than MySQL.

You might want to look into MySQL Proxy. This doesn't match the architecture of Linked Servers/dblink, but you can probably solve a similar set of problems that you would use Linked Servers/dblink to solve.

3
  • FEDERATED is a great. but please, maybe you now, have a way to address to other server something like this(as for SQL Server or postgres/oracle dblink) - OTHER_SERVER.remote_table? Because in a future would a lot count of tales with name like this - table_name_1...table_name_X. And I must generate query dynamically. and in "federated" case necessary create tables in local machine. Thanks for advance.
    – Tioma
    Mar 20, 2011 at 20:31
  • 1
    @Tioma: See How to Use FEDERATED Tables -- there's no support for OTHER_SERVER specification, you just incorporate the info into the table name. If you'd like to see functionality/support similar to Linked Servers/etc, you're best off either voting for an existing feature request or logging one of your own with MySQL/Oracle.
    – OMG Ponies
    Mar 20, 2011 at 20:48
  • As per the provided link for the documentation, I see only the method to create a table on a remote server. But how to link an existing table from a remote server? Please help.
    – tarekahf
    Aug 28, 2018 at 16:04
6

I am the developer of the MySQL Data Controller. Unfortunately, since we had lack of requests we have stopped development on it. The plugin was 100% functional with MySQL connecting to Oracle, MSSQL or MySQL.

Base on some requests, we had added back a blog and video about it :

http://www.acentera.com/mysql-datacontroller/

Regards, Francis L.

2

Unfortunately you cannot link an entire MySQL database to another MySQL database like you can with MS SQL. However, you can link individual tables. A federated table is a local table you create that points to a table on another server.

You can run queries and stored procedures just like any other table. The two tables must have the same structure, except the Federated table uses a different database engine: Federated. If you make ANY changes to the structure of the remote table, you should re-create the local federated table.

The process is actually quite easy, here is an example: https://docs.oracle.com/cd/E17952_01/mysql-5.0-en/federated-use.html

In my experience, the time needed to create and implement this process is minimal, even when compared to linked servers. It should take you less than 30 minutes to get your first federated table working, after that its a 5 min process. Last item, when naming your federated table, I give it the same name as the remote table with a "federated_" in front, like federated_customer.

Also, store your federated table definitions as separate stored procedures so you can reuse them anytime you need to create the federated table again, AND so that other developers can see how you generated the federated table.

1
  • MySQL inability to access linked servers is one reason why we chose not to use it in one of our projects and chose MSQ SQL. MS SQL Servers ability to do linked servers and query across different databases on the same server is a HUGE win. HOWEVER, Azure is a whole different ball game. SQL Server for Azure does NOT let you query across databases WITHOUT creating federated tables! They call them "Elastic tables" .. a fancy name for a very poor solution. Federated tables are not difficult, but they are unnecessary
    – Clark Vera
    Mar 9, 2021 at 17:21
1

The MySQL Data Controller is a follow-on to the federated engine that allows connection to different database types, such as Microsoft SQL Server or Oracle. I am not sure how development is going, yet.

See: http://en.wikipedia.org/wiki/MySQL_DataController

or: https://launchpad.net/datacontroller

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.