pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Rich <rhdyes@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to write sql to access another odbc source.
Date: Tue, 25 Oct 2011 15:59:52 +0800
Message-ID: <4EA66C78.3020600@ringerc.id.au> (raw)
In-Reply-To: <CABDj5P1q=vOZbvhce7jNFNPciSGvkYTRtDaMXQa=wa3AG_8PMA@mail.gmail.com>
References: <CABDj5P1q=vOZbvhce7jNFNPciSGvkYTRtDaMXQa=wa3AG_8PMA@mail.gmail.com>

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



view thread (2+ messages)

Message-ID: <4EA66C78.3020600@ringerc.id.au>
Permalink:  ../4EA66C78.3020600@ringerc.id.au/
Also on:    postgresql.org/message-id/4EA66C78.3020600@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ringerc@ringerc.id.au, rhdyes@gmail.com
  Subject: Re: How to write sql to access another odbc source.
  In-Reply-To: <4EA66C78.3020600@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox