Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating database link in posgresSQL to connect to SQL Server 2008

Are there any way to connect PostgreSQL to SQL Server? I found this link http://pgfoundry.org/projects/dblink-tds/ but are there other ways?

like image 798
kinkajou Avatar asked Apr 07 '12 12:04

kinkajou


People also ask

How do I create a database link in PostgreSQL?

Load the dblink extension into PostgreSQL. CREATE EXTENSION dblink; Create a persistent connection to a remote PostgreSQL database using the dblink_connect function specifying a connection name (myconn), database name (postgresql), port (5432), host (hostname), user (username) and password (password).

Does Postgres have database links?

Database Link in PostgreSQL enables a database user to access a table present on a different PostgreSQL cluster. It provides a functionality in PostgreSQL similar to that of DB Link in Oracle, Linked Server in SQL Server and Federated Table in MySQL.

What is DB link in Postgres?

dblink is a module that supports connections to other PostgreSQL databases from within a database session. See also postgres_fdw, which provides roughly the same functionality using a more modern and standards-compliant infrastructure.


1 Answers

You might be able to do something using one of PostgreSQL's server languages, e.g. pl/pythonu. For any given query you could write a function in that language which fetches the results from the remote server, using the language's own DB access modules. So in pl/pythonu you would use a Python DB-API module for SQL Server access.

  • http://www.postgresql.org/docs/current/static/plpython.html
  • http://wiki.python.org/moin/SQL%20Server
like image 75
Edmund Avatar answered Sep 22 '22 22:09

Edmund