by Anton Dziavitsyn 2019
a.dziavitsyn@gmail.com
Repository on GitHub: https://github.com/Muritiku/postgres-tds
Builded docker image: muritiku/postgres-tds
You can use docker-compose.yml to build postgres+adminier for tests:
docker-compose -f pgsql-adminer.yml up
Then connect to postgreSQL instance, with using user: postgres, password: 1234
You may change credentials with using environment variables (POSTGRES_USER and POSTGRES_PASSWORD) in compose file.
Activate extension:
CREATE EXTENSION tds_fdw;
Connect server:
CREATE SERVER mssql_svr
FOREIGN DATA WRAPPER tds_fdw
OPTIONS (servername '127.0.0.1', port '1433', database 'tds_fdw_test', tds_version '7.1');
Grant user access:
GRANT USAGE ON FOREIGN SERVER mssql_svr TO postgres_username;
Create user mapping:
CREATE USER MAPPING FOR postgres_username
SERVER mssql_svr
OPTIONS (username 'sa', password '');
Import MS-SQL schema:
IMPORT FOREIGN SCHEMA dbo
FROM SERVER mssql_svr
INTO public
OPTIONS (import_default 'true');
Activate extension:
CREATE EXTENSION oracle_fdw;
Connect server:
CREATE SERVER oradb FOREIGN DATA WRAPPER oracle_fdw
OPTIONS (dbserver '//dbserver.mydomain.com:1521/ORADB');
Grant user access:
GRANT USAGE ON FOREIGN SERVER oradb TO postgres_username;
Create user mapping:
CREATE USER MAPPING FOR postgres_username
SERVER oradb
OPTIONS (user 'orauser', password 'orapwd');
Import ORACLE schema:
IMPORT FOREIGN SCHEMA ORA_SCHEMA
FROM SERVER oradb
INTO public;