1
PostgreSQL ODBC driver on Debian
2
================================
4
This package contains the PostgreSQL ODBC driver built for the
5
unixODBC driver manager. Applications wishing to make use of it need
6
work with unixODBC (instead of some other ODBC driver manager). On
7
Debian, this normally means that they have a dependency on the package
10
Setup of odbc-postgresql
11
------------------------
13
Register the PostgreSQL driver in /etc/odbcinst.ini:
15
# odbcinst -i -d -f /usr/share/psqlodbc/odbcinst.ini.template
17
Add additional ODBC functions to the databases that you plan to access
21
$ for dbname in database1 database2 ...
23
psql -d $dbname < /usr/share/psqlodbc/odbc.sql
26
If you include template1 in the list, any database created in future
27
will automatically have these functions included when it is created.
29
To be able to access a particular database via ODBC you need to
30
register it as an ODBC data source. Data sources are registered
31
globally in /etc/odbc.ini or for each user in ~/.odbc.ini. An example
32
entry is included in this package. You can install it like this:
34
# cat /usr/share/doc/odbc-postgresql/examples/odbc.ini.template >>/etc/odbc.ini
36
This will give you read-only access to the template1 database on the
37
PostgreSQL server on localhost.
39
You should edit /etc/odbc.ini as required, to add extra databases,
40
change the read only status, and so on.
42
At this point, you should be able to use the ODBC access features of
43
any application to connect to any of the listed databases. For
44
example, in OpenOffice.org, you can click Tools->Data Sources, select
45
the ODBC database type, and browse the list of databases from
46
/etc/odbc.ini and ~/.odbc.ini.
48
A good and reliable way for a user to add a template to his
49
~/.odbc.ini without risk of damaging the file is to use this command:
51
$ odbcinst -i -s -f /path/to/your/template/file
57
If you have schemas that are not in the default search path ($user,
58
public) you have to set the search path in the connection settings of
59
the odbc.ini file. Here's an example, where the search path must be
63
Description = Production control
66
TraceFile = /tmp/psqlodbc.log
68
Servername = localhost
78
ConnSettings = SET SEARCH_PATH TO prod, public