Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link from Postgresql to SQL Server via ODBC?

I need to be able to query a SQL Server database from within Postgresql. The Postgres instance is running locally and the SQL server set up as an ODBC data source. How do I add this as a linked server? Is there a better approach?

Thanks

like image 310
ZeroEric Avatar asked Feb 21 '13 19:02

ZeroEric


1 Answers

The two available options are:

  • DBI-Link; or
  • The ODBC-FDW (SQL/MED foreign data wrapper)

DBI-link is more mature, and will work on Windows. The ODBC FDW is likely to be better once it's properly finished, but at this point it isn't, and AFAIK it is not available on Windows.

See:

  • http://wiki.postgresql.org/wiki/Foreign_data_wrappers
  • http://pgfoundry.org/projects/dbi-link
like image 80
Craig Ringer Avatar answered Oct 21 '22 02:10

Craig Ringer