Unsupported versions: 7.2 / 7.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

7.2. Installation

In order to make use of an ODBC driver there must exist a driver manager on the system where the ODBC driver is to be used. There are two free ODBC driver managers for Unix-like operating systems known to us: iODBC and unixODBC. Instructions for installing these driver managers are to be found in the respective distribution. Software that provides database access through ODBC should provide its own driver manager (which may well be one of these two). Having said that, any driver manager that you can find for your platform should support the PostgreSQL ODBC driver, or any other ODBC driver for that matter.

Note: The unixODBC distribution ships with a PostgreSQL ODBC driver of its own, which is similar to the one contained in the PostgreSQL distribution. It is up to you which one you want to use. We plan to coordinate the development of both drivers better in the future.

To install the ODBC you simply need to supply the --enable-odbc option to the configure script when you are building the entire PostgreSQL distribution. The library will then automatically be built and installed with the rest of the programs. If you forget that option or want to build the ODBC driver later you can change into the directory src/interfaces/odbc and do make and make install there.

It is also possible to build the driver to be specifically tuned for use with iODBC or unixODBC. This means in particular that the driver will use the driver manager's routines to process the configuration files, which is probably desirable since it creates a more consistent ODBC environment on your system. If you want to do that, then supply the configure options --with-iodbc or --with-unixodbc (but not both).

If you build a "stand-alone" driver (not tied to iODBC or unixODBC), then you can specify where the driver should look for the configuration file odbcinst.ini. By default it will be the directory /usr/local/pgsql/etc/, or equivalent, depending on what --prefix and/or --sysconfdir options you supplied to configure. To select a specific location outside the PostgreSQL installation layout, use the --with-odbcinst option. To be most useful, it should be arranged that the driver and the driver manager read the same configuration file.

Additionally, you should install the ODBC catalog extensions. That will provide a number of functions mandated by the ODBC standard that are not supplied by PostgreSQL by default. The file /usr/local/pgsql/share/odbc.sql (in the default installation layout) contains the appropriate definitions, which you can install as follows:

psql -d template1 -f LOCATION/odbc.sql

where specifying template1 as the target database will ensure that all subsequent new databases will have these same definitions. If for any reason you want to remove these functions again, run the file odbc-drop.sql through psql.