Trung Dao
Trung Dao

Reputation: 50

'Error on remote system: 0 'when using FederatedX on MariaDB

I am using MariaDB 10.1 64x and experiencing error with FederatedX engine. First, I create an server:

CREATE SERVER AAA_fed
Foreign data Wrapper mysql_1
OPTIONS (
    User 'user1',
    password 'password',
    host 'x.x.x.x',
    Port 3306,
    database 'AAA'
    );

and then create federated table using connection to the server.

CREATE TABLE table1 
ENGINE = FEDERATED 
CONNECTION='AAA_fed';

The table is created successfully, but when selecting data from it, it response an error:

Error Code: 1296. Got error 10000 'Error on remote system: 0: ' from FEDERATED

Does anyone know the solution to this? I keep searching but cannot find the answer. Thank you.

Upvotes: 0

Views: 1065

Answers (2)

ASammour
ASammour

Reputation: 1009

There is also one reason for this error. Which occurs when you created a federated table, that pointing to a table in the same server.

Upvotes: 0

wchiquito
wchiquito

Reputation: 16551

WRAPPER should be a recognized connection protocol.

Example:

MariaDB [(none)]> SELECT VERSION();
+--------------------------+
| VERSION()                |
+--------------------------+
| 10.1.14-MariaDB-1~xenial | -- 64 bit
+--------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> DROP DATABASE IF EXISTS `BBB`;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> DROP DATABASE IF EXISTS `AAA`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `AAA`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `BBB`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE TABLE IF NOT EXISTS `AAA`.`table1` (
    ->   `id` int(20) NOT NULL,
    ->   `name` varchar(64) NOT NULL default ''
    -> ) ENGINE='InnoDB';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> DROP SERVER IF EXISTS `AAA_fed`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE SERVER IF NOT EXISTS `AAA_fed`
    -> FOREIGN DATA WRAPPER `mysql_1` -- <-- Unsupported
    -> OPTIONS (
    ->   HOST 'x.x.x.x',
    ->   DATABASE 'AAA',
    ->   USER 'user1',
    ->   PASSWORD 'password',
    ->   PORT 3306,
    ->   SOCKET '/path/to/mysqld.sock',
    ->   OWNER 'user1'
    -> );
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE TABLE IF NOT EXISTS `BBB`.`table1`
    -> ENGINE=FEDERATED CONNECTION='AAA_fed';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SELECT `id`, `name` FROM `BBB`.`table1`;
ERROR 1296 (HY000): Got error 10000 'Error on remote system: 0: ' from FEDERATED

MariaDB [(none)]> DROP TABLE IF EXISTS `BBB`.`table1`;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> DROP SERVER IF EXISTS `AAA_fed`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE SERVER IF NOT EXISTS `AAA_fed`
    -> FOREIGN DATA WRAPPER `mysql` -- <-- Supported
    -> OPTIONS (
    ->   HOST 'x.x.x.x',
    ->   DATABASE 'AAA',
    ->   USER 'user1',
    ->   PASSWORD 'password',
    ->   PORT 3306,
    ->   SOCKET '/path/to/mysqld.sock',
    ->   OWNER 'user1'
    -> );
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE TABLE IF NOT EXISTS `BBB`.`table1`
    -> ENGINE=FEDERATED CONNECTION='AAA_fed';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SELECT `id`, `name` FROM `BBB`.`table1`;
Empty set (0.00 sec)

Upvotes: 0

Related Questions