Solved

Setting up FEDERATED Table recieve MySQL Database Error: Unable to connect to foreign data source:

Posted on 2008-06-12
4
1,829 Views
Last Modified: 2012-05-05
Setting up a FEDERATED storage ENGINE to link a masted and remote table
I get the following error MySQL Database Error: Unable to connect to foreign data source: Unknown MySQL server host
when inserting into master, both master and remote then error out and can not drop table
## Create TABLE on Master
 
CREATE TABLE `events` (
  `id` int(11) NOT NULL,
  `event_type` varchar(255) DEFAULT NULL,
  `name` 
varchar(255) DEFAULT NULL,
  `description` text,
  `created_by_id` int(11) DEFAULT NULL,
  
`updated_by_id` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime 
DEFAULT NULL,
  `vendor_id` int(11) DEFAULT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT 
CHARSET=latin1;
 
 
## Create TABLE on Remote
 
CREATE TABLE `events` (
  `id` int(11) NOT NULL,
  `event_type` varchar(255) DEFAULT NULL,
  `name` 
varchar(255) DEFAULT NULL,
  `description` text,
  `created_by_id` int(11) DEFAULT NULL,
  
`updated_by_id` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime 
DEFAULT NULL,
  `vendor_id` int(11) DEFAULT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT 
CHARSET=latin1;
 
 
## Create Federated in Master
 
CREATE TABLE `events_F` (
  `id` int(11) NOT NULL,
  `event_type` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `description` text,
  `created_by_id` int(11) DEFAULT NULL,
  `updated_by_id` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `vendor_id` int(11) DEFAULT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://<user>:<password>@<host>:3306/Edge/events'
Commit;
 
## Create Trigger on Master
 
CREATE TRIGGER `Core`.`Events_insert` After INSERT
    ON Core.events FOR EACH ROW
BEGIN
insert into Core.events_F values
(
NEW.id,
NEW.event_type,
NEW.name,
NEW.description,
NEW.created_by_id,
NEW.updated_by_id, 
NEW.created_at,
NEW.updated_at,
NEW.vendor_id);
END;
Commit;

Open in new window

0
Comment
Question by:IcueTV
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
ID: 21779851
   Hi!

This can be due to several reasons
1) remote hostname is unknown to the calling host. -> Solved by altering dns records or adding the IP and hostname to hosts file.
2) Firewall is blocking the caller host to connect to the remote host.
3) Security in mysql on  the remote host does not allow the calling host to connect.

http://dev.mysql.com/doc/refman/5.0/en/federated-use.html
http://dev.mysql.com/doc/refman/5.0/en/federated-limitations.html
http://dev.mysql.com/doc/refman/5.0/en/privilege-system.html
http://dev.mysql.com/doc/refman/5.0/en/user-account-management.html
http://dev.mysql.com/doc/refman/5.0/en/server-administration.html

Regards,
    Tomas Helgi
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 21873764
Did my earlier comment help you ?

Regards,
    Tomas Helgi
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now