データベースリンク

create database link dblink1 connect to test identified by test using 'orcl';

select * from dba_db_links;

select * from v$instance@dblink1;

https://qiita.com/shigekid/items/a087cdd5d0c074859688

vim /etc/my.cnf

[mysqld]
federated=1


show engines;

CREATE TABLE `tab1f` (
`col1` int(11) DEFAULT NULL,
KEY `ind11f` (`col1`)
) ENGINE= FEDERATED
CONNECTION='mysql://root:password@192.168.137.50/test/tab1';

 

http://d.hatena.ne.jp/s87/20130312/1363089347
http://sios-oss.blogspot.com/2014/05/postgresqlfdwforeign-data-wrapper.html

CREATE EXTENSION postgres_fdw;

\dx
\dx+

CREATE SERVER remote_postgres FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '127.0.0.1', port '5432', dbname 'test2');

\des+

CREATE USER MAPPING FOR PUBLIC SERVER remote_postgres OPTIONS (password 'postgres');

\deu+

drop foreign table remote_tab1;
CREATE FOREIGN TABLE remote_tab1(col1 int) SERVER remote_postgres OPTIONS (table_name 'tab1');

\det
\det+

select * from remote_tab1;
explain select * from remote_tab1;

 

リンクサーバー

USE [master]
GO
EXEC master.dbo.sp_addlinkedserver
@server = N'MMM060\instance1',
@srvproduct=N'SQL Server' ;
GO


SELECT * FROM [MMM060\instance1].test.dbo.tab1 ;
GO