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

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Rich <rhdyes(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to write sql to access another odbc source.
Date: 2011-10-25 07:59:52
Message-ID: 4EA66C78.3020600@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Harald Fuchs 2011-10-25 12:42:34 Re: CTE or Subselect and outer joins not behaving as expected?
Previous Message Brice André 2011-10-25 06:02:19 Re: Handling mutliple clients access with views