Обсуждение: How to write sql to access another odbc source.

Поиск
Список
Период
Сортировка

How to write sql to access another odbc source.

От
Rich
Дата:
I have a mumps database with an ODBC connection so I can write queries from other databases.  How can I write a sql in
Postgresqlto access this table to use in my Postgresql reports?<br /> 

Re: How to write sql to access another odbc source.

От
Craig Ringer
Дата:
On 19/10/11 22:08, Rich wrote:
> I have a mumps database with an ODBC connection so I can write queries
> from other databases.  How can I write a sql in Postgresql to access
> this table to use in my Postgresql reports?

Use dbi-link to make an ODBC connection to the other database. Either
copy the data into a PostgreSQL table for processing, or make a view
over the dbi-link function call to query the data each time. The latter
option is slow, but requires no periodic refreshing of the copied table.

If you're on PostgreSQL 9.1 I'd recommend copying the data from the
other database via dbi-link into an unlogged table.

See: http://pgfoundry.org/projects/dbi-link and the documentation for
the dbi-link contrib module in your version of PostgreSQL.

Hopefully in 9.2 the odbc foreign data wrapper will be working and ready
for general use, in which case you'll be able to do it even more easily
using ODBC FDW (SQL/MED).



--
Craig Ringer