PostgreSQL9.3 Installing TDS_FDW Extensions

Source: Internet
Author: User
Tags git clone

PostgreSQL supports the so-called appearance function from the 9.x, that is, in PostgreSQL by installing some extensions and then doing some configuration, you can create a local surface mapping to other different types of databases ( Can be broadly understood as dblink across PostgreSQL and other types of databases)

Today we introduce the method of mapping SQL Server database through TDS_FDW extension in PostgreSQL

Environment: ubunut14,postgresql9.3,sqlserver2005

FDW is essentially an extension of PostgreSQL, it cannot communicate directly with other databases, so you must install clients that can communicate with other database servers (such as MYSQLCLIENT,ORACLECLIENT,FREETDS, etc.)

--Installation FreeTDS
Apt-get Install LIBSYBDB5 Freetds-dev Freetds-common
--Installing PostgreSQL
Apt-get Install postgresql-9.3 postgresql-client-9.3 postgresql-server-dev-9.3

--Download, upload to the server, and compile (can be placed in any directory):
git clone https://github.com/GeoffMontee/tds_fdw.git
CD TDS_FDW
Make Use_pgxs=1
Make Use_pgxs=1 Install
--Create plugins (executed in pgadmin)
CREATE EXTENSION TDS_FDW

--Create server (execute in pgadmin)
CREATE Server server
FOREIGN DATA WRAPPER TDS_FDW
OPTIONS (servername ' database IP ', character_set ' UTF-8 ', Port ' 1433 ');

--Create mappings (performed in pgadmin)
CREATE USER MAPPING for Postgres
Server server
OPTIONS (username ' database user name ', password ' database password ');

--Creating appearances

CREATE FOREIGN TABLE Ext_test (
ID2 int not NULL,
Name varchar (255) is not NULL,
Code varchar (255) NULL
)

Server server
OPTIONS (database name, query ' select ID2, name,code from Project ');

--Querying data
SELECT * from Ext_test;

--Remove appearances

Drop FOREIGN Table Ext_project

Ps:

Address of the TDS_FDW project: HTTPS://GITHUB.COM/GEOFFMONTEE/TDS_FDW

MYSQL_FDW Project Address: HTTPS://GITHUB.COM/DPAGE/MYSQL_FDW

PostgreSQL9.3 Installing TDS_FDW Extensions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.