+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
-<html>\r
- <head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">\r
- <title>psqlODBC HOWTO - Debian</title>\r
- </HEAD>\r
-\r
- <body bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000" alink="#0000ff">\r
- \r
-<h1>psqlODBC HOWTO - Debian</h1>\r
-\r
-<p>\r
-\r
-<i>\r
-Author: Oliver Elphick (olly@lfix.co.uk)<br>\r
-Release Date: 17 April 2002<br>\r
-Amendments: 16 July 2002<br>\r
-Amendments: 17 March 2003<br>\r
-Amendments: 11 August 2005<br>\r
-Description: Debian Linux: HOWTO set up odbc-postgresql with unixodbc to allow access to other Unix programs\r
-</i>\r
-<br><br>\r
-<p>\r
-Please be aware that these notes were written for the Debian installation of \r
-PostgreSQL and UnixODBC. With other distributions, or with the upstream\r
-source, package names and pathnames will be different.\r
-\r
-<p>\r
-<b>1.</b> Install odbc-postgresql and the packages unixodbc and odbcinst1<br><br>\r
-\r
-<b>2.</b> Add a PostgreSQL driver to /etc/odbcinst.ini:<br><br>\r
-\r
-<blockquote><i># odbcinst -i -d -f /usr/share/psqlodbc/odbcinst.ini.template</i></blockquote>\r
-\r
-<b>3.</b> Add the template1 database (with read only access) to the default odbc.ini<br><br>\r
-\r
-<blockquote><i># cat /usr/share/doc/odbc-postgresql/examples/odbc.ini.template >>/etc/odbc.ini</i></blockquote>\r
-\r
- Edit /etc/odbc.ini as required, to add extra databases, change the read only\r
- status and so on.<br><br>\r
-\r
-<b>4.</b> For release 07 of psqlodbc, add ODBC required functions to the databases that you wish to access from ODBC:<br><br>\r
-\r
-<i><blockquote>\r
- # su -s /bin/bash - postgres<br>\r
- $ for dbname in database1 database2 ...<br>\r
- do<br>\r
- psql -d $dbname < /usr/share/psqlodbc/odbc.sql<br>\r
- done<br>\r
-</i></blockquote>\r
-\r
- If you include template1 in the list, any database created in future will\r
- automatically have these functions included when it is created.\r
-</p>\r
-<p>For release 08, step 4 is not required, because the driver does the conversion automatically.\r
-</p>\r
-<p>\r
-At this point, you should be able to use the ODBC access features of any\r
-application to connect to any of the listed databases. For example, in\r
-StarOffice, you can click New->Database, select the ODBC database type\r
-and browse the list of databases from /etc/odbc.ini and ~/.odbc.ini.\r
-</p>\r
-\r
-<p>\r
-Each user has or can have a file ~/.odbc.ini, whose structure is the same\r
-as /etc/odbc.ini. This file is read together with the /etc/odbc.ini to give\r
-a complete list of databases accessible to the user. (Of course, any\r
-access restrictions imposed by pg_hba.conf are still applicable.)\r
-</p>\r
-\r
-<p>\r
-You can create templates for different databases and allow users to add\r
-them to their own ~/.odbc.ini. Use the odbc.ini template file provided in\r
-/usr/share/doc/odbc-postgresql/examples/odbc.ini.template as a model.\r
-</p>\r
-\r
-<p>\r
-A good and reliable way for a user to add a template to his ~/.odbc.ini\r
-without risk of damaging his file is for him to use this command:\r
-</p>\r
-\r
-<blockquote><i>$ odbcinst -i -s -f /path/to/your/template/file</i></blockquote>\r
-\r
-<p>\r
-Note: I have had a report that OpenOffice objects to tabs and/or whitespace\r
-in ~/.odbc.ini and /etc/odbc.ini. I have not found this problem with\r
-StarOffice 5, however. Neither does it seem to be a problem in openoffice.org 1.4.\r
-</p>\r
-\r
-<b>Sample odbcinst.ini file</b>\r
-\r
-<blockquote>\r
-<pre>\r
-[PostgreSQL]\r
-Description=PostgreSQL ODBC driver for Linux and Windows\r
-Driver=/usr/lib/postgresql/lib/libodbcpsql.so\r
-Setup=/usr/lib/odbc/libodbcpsqlS.so\r
-Debug = 0\r
-CommLog = 1\r
-</pre>\r
-</blockquote>\r
-\r
-<b>Sample odbc.ini file</b>\r
-\r
-<blockquote>\r
-<pre>\r
-[PostgreSQL]\r
-Description = PostgreSQL template1\r
-Driver = PostgreSQL\r
-Trace = No\r
-TraceFile = /tmp/odbc.log\r
-Database = template1\r
-Servername = localhost\r
-UserName =\r
-Password =\r
-Port = 5432\r
-Protocol = 6.4\r
-ReadOnly = Yes\r
-RowVersioning = No\r
-ShowSystemTables = No\r
-ShowOidColumn = No\r
-FakeOidIndex = No\r
-ConnSettings =\r
-</pre>\r
-</blockquote>\r
-\r
-<p>This additional sample connection sets the schema search path in ConnSettings, to give\r
-access to a schema that would otherwise be inaccessible.</p>\r
-\r
-<blockquote>\r
-<pre>\r
-[Production]\r
-Description = Production control \r
-databaseDriver = PostgreSQL\r
-Trace = NoTrace\r
-File = /tmp/odbc.log\r
-Database = production\r
-Servername = localhost\r
-UserName = \r
-Password =\r
-Port = 5432\r
-Protocol = 6.4\r
-ReadOnly = No\r
-RowVersioning = Yes\r
-ShowSystemTables = No\r
-ShowOidColumn = No\r
-FakeOidIndex = No\r
-ConnSettings = SET SEARCH_PATH TO prod, public\r
-\r
-</pre>\r
-</blockquote>\r
-\r
-</p>\r
-\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
-<html>\r
- <head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">\r
- <title>psqlODBC HOWTO - Redhat</title>\r
- </HEAD>\r
-\r
- <body bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000" alink="#0000ff">\r
- \r
-<h1>psqlODBC HOWTO - Redhat</h1>\r
-\r
-<p>\r
-\r
-<i>\r
-Author: Pavel Cenek (xcenek@fi.muni.cz)<br>\r
-Release Date: 12 February 2002<br>\r
-Description: Installation and configuration of PostgreSQL & ODBC on Redhat Linux\r
-</i>\r
-<br><br>\r
-\r
-<b>0) Notes</b><p>\r
-\r
-I tried the installation on Red Hat Linux 7.1 with PostgreSQL 7.1.3 Some tricks which are not \r
-documented in one place (or are not documented at all) are written here. This file is not \r
-intended to replace PostgreSQL documentation. If you have any trouble read the \r
-<a href="http://www.postgresql.org/docs">manual</a>!!<br><br>\r
-\r
-Every rpm has version number in the name, I use names without versions to \r
-refer to rpm files in the following text.<br><br>\r
-\r
-\r
-<b>1) Installing and configuring PostgreSQL</b><p>\r
-\r
-From <a href="ftp://ftp.postgresql.org">ftp://ftp.postgresql.org</a> or preferrably from a mirror site download the following rpms:<br><br>\r
-\r
-<center>\r
-<table border=1 width="424" cellpadding="2" cellspacing="1">\r
- <tr><td width="157">postgresql</td><td width="257">client binaries, docs, man pages</td></tr>\r
- <tr><td width="157">postgresql-server</td><td width="257">server binaries, some docs</td></tr>\r
- <tr><td width="157">postgresql-libs</td><td width="257">shared libraries</td></tr>\r
- <tr><td width="157">postgresql-test</td><td width="257">files for testing DB functionality</td></tr>\r
- <tr><td width="157">postgresql-devel</td><td width="257">header files and developers libraries</td></tr>\r
-</table>\r
-</center>\r
-\r
-<br><br>\r
-\r
-Type\r
-<blockquote>\r
- <p> <i>rpm -i <list of rpms></i> </p>\r
-</blockquote>\r
-<p>for installing, or </p>\r
-<blockquote>\r
- <p> <i>rpm -U <list of rpms></i> </p>\r
-</blockquote>\r
-<p>for upgrade.<br><br>\r
-\r
-After installing we ensure that PostgreSQL will be started at boot time.<br><br>\r
-\r
-Add a symlink from</p>\r
-<blockquote>\r
-<p> <i>/etc/rc.d/rcL.d/KXYpostgresql</i> </p>\r
-</blockquote>\r
-<p>and </p>\r
-<blockquote>\r
-<p> <i>/etc/rc.d/rcL.d/SXYpostgresql</i> </p>\r
-</blockquote>\r
-<p>to </p>\r
-<blockquote>\r
-<p> <i>/etc/rc.d/init.d/postgresql</i> </p>\r
-</blockquote>\r
-<p>for every runlevel L on which you want postgres to be started (XY is a number).\r
-\r
-If you want to access the DB via TCP/IP (required for ODBC access), in the file\r
- <i>/etc/rc.d/init.d/postgresql</i>\r
-add to the line looking like this:</p>\r
-<blockquote>\r
-<p><i> su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D -p /usr/bin/postmaster start > /dev/null 2>&1" < /dev/null </i></p>\r
-</blockquote>\r
-<p>the parameters -o & -i\r
- e.g.</p>\r
-<blockquote>\r
-<p><i>su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D -o -i -p /usr/bin/postmaster start > /dev/null 2>&1" < /dev/null\r
-\r
-</i></p>\r
-</blockquote>\r
-<p>The last thing to do is to set up access rights in file\r
- /var/lib/pgsql/data/pg_hba.conf as required. </p>\r
-<p>Now, type:</p>\r
-<blockquote>\r
-<p><i>/etc/rc.d/init.d/postgresql start</i></p>\r
-</blockquote>\r
-<p>to start the DB server.\r
-\r
-You can go to the directory\r
- <i>/usr/lib/pgsql/test/regress</i>\r
-and run tests of DB functionality (read README in that directory) if required.</p>\r
-<p><b>2) Installing and configuring ODBC</b> </p>\r
-<p>From <a href="ftp://ftp.postgresql.org">ftp://ftp.postgresql.org</a> or from a mirror site get from the section "software" following rpm:\r
-\r
-\r
-</p>\r
-\r
-<center>\r
-<table border=1 width="424" cellpadding="2" cellspacing="1">\r
- <tr>\r
- <td width="157">postgresql-odbc</td>\r
- <td width="257">libraries and ini files</td>\r
- </tr>\r
-</table>\r
-</center>\r
-\r
-Type\r
-<blockquote>\r
- <p> <i>rpm -i <list of rpms></i> </p>\r
-</blockquote>\r
-<p>for installing, or </p>\r
-<blockquote>\r
- <p> <i>rpm -U <list of rpms></i> </p>\r
-</blockquote>\r
-<p>for upgrade.<br><br>\r
-\r
-Type:</p>\r
-<blockquote>\r
-<p><i>psql -d template1 -f /usr/share/pgsql/odbc.sql </i>\r
-\r
-\r
-</p>\r
-</blockquote>\r
-<p>to add some extra sql definitions to the template1 database.\r
-\r
-\r
-</p>\r
-<p>From the PostgreSQL interactive terminal (psql), in the template1 database, execute the following SQL:</p>\r
-<blockquote>\r
-<p><i>create type lo ( <br>\r
- internallength=4, <br>\r
- externallength=10, <br>\r
- input=int4in, <br>\r
- output=int4out, <br>\r
- default='', <br>\r
- passedbyvalue <br>\r
-); </i>\r
-\r
-\r
-</p>\r
-</blockquote>\r
-<p>to add support for blobs accessible via ODBC. Quit psql with the \q command. Every created database inherits all \r
-definitions from template1 unless specified otherwise, so you should have all definitions in every DB you create.\r
-\r
-\r
-</p>\r
-<p><b>3) Installing and configuring iODBC Driver Manager</b></p>\r
-<p>From <a href="http://www.iodbc.org/">http://www.iodbc.org/</a> get from the section "software download", the \r
-iODBC Driver Manager, i.e. following rpms:\r
-\r
-</p>\r
-\r
-<center>\r
-<table border=1 width="424" cellpadding="2" cellspacing="1">\r
- <tr>\r
- <td width="157">libiodbc</td>\r
- <td width="257">iODBC Driver Manager Runtime Package (libraries, config files)</td>\r
- </tr>\r
- <tr>\r
- <td width="157">libiodbc-devel</td>\r
- <td width="257">iODBC Developers Kit (odbc header files and developers libraries)</td>\r
- </tr>\r
-</table>\r
-</center>\r
-\r
-Type\r
-<blockquote>\r
- <p> <i>rpm -i <list of rpms></i> </p>\r
-</blockquote>\r
-<p>for installing, or </p>\r
-<blockquote>\r
- <p> <i>rpm -U <list of rpms></i> </p>\r
-</blockquote>\r
-<p>for upgrade.<br><br>\r
-\r
-Now we have to configure /etc/odbc.ini and and /etc/odbcinst.ini if you only use PostgreSQL via ODBC, you can replace <i>/etc/odbcinst.ini</i> with <i>/etc/pgsql/odbcinst.ini:</i></p>\r
-<blockquote>\r
-<p><i>cp /etc/pgsql/odbcinst.ini /etc/odbcinst.ini </i>\r
-\r
-</p>\r
-</blockquote>\r
-<p>Otherwise you have to edit <i>/etc/odbcinst.ini</i> and copy the relevant parts from <i>/etc/pgsql/odbcinst.ini</i>. Be careful, this file is PARTIALLY case sensitive. It means some attributes are, some are not. If you have trouble with connection to PostgreSQL via ODBC, check if parameters in your /etc/odbc.ini have the same case as in the following example:\r
-\r
-</p>\r
-<blockquote>\r
- <i>\r
-<code>------ /etc/odbc.ini file begin ----- <br>\r
- ;<br>\r
- ; odbc.ini <br>\r
- ; <br>\r
- [ODBC Data Sources] <br>\r
- test = PostgreSQL Test<br>\r
- <br>\r
- [test] <br>\r
- Driver=/usr/lib/libpsqlodbc.so <br>\r
- Description=Sample PostgreSQL DSN <br>\r
- DSN=test<br>\r
- Servername=localhost <br>\r
- Username=gin2 <br>\r
- Database=mydb <br>\r
- ReadOnly=No <br>\r
- Servertype=postgres <br>\r
- Port=5432 <br>\r
- FetchBufferSize=99 <br>\r
- ServerOptions= <br>\r
- ConnectOptions= <br>\r
- Options= <br>\r
- ReadOnly=no <br>\r
- Trace=1 <br>\r
- TraceFile=/home/gin2/odbc.trace <br>\r
- Debug=1 <br>\r
- DebugFile=/home/gin2/odbc.debug <br>\r
- CommLog=1 <br>\r
- </code></i><p><i>\r
-<code>[Default] <br>\r
- Driver = /usr/lib/libpsqlodbc.so <br>\r
- <br>\r
- [ODBC] <br>\r
- InstallDir = /usr/lib/libiodbc.so <br>\r
- <br>\r
- ------ /etc/odbc.ini file end ----- </code>\r
- </i></p>\r
-</blockquote>\r
-<p>If you have done everything properly :-), the installation and setup is now finished. </p>\r
-<p><b>4. Testing ODBC</b></p>\r
-<p>With iODBC Driver Manager package should be distributed a small testing program <i>odbctest</i>. I haven't found it, so I took its source directly from CVS and compiled it myself. This command worked fine for me: <http://www.iodbc.org/cgi-bin/cvsweb.cgi/iODBC/samples/odbctest.c>\r
-\r
-</p>\r
-<blockquote>\r
-<p><i>gcc -c odbctest.c -o odbctest.o gcc -s -o odbctest odbctest.o -liodbc</i>\r
-</p>\r
-</blockquote>\r
-<p>Notice the <i>-liodbc</i> -- every program using ODBC must be linked with iodbc library. It is also not very well documented (at least I found it nowhere). You can now run the <i>odbctest</i> binary. If you run it without parameters, it asks you for an ODBC connect string. If you enter '?', it lists all dsn names (taken from <i>/etc/odbc.ini</i>. Be careful, the right ODBC connect string is not "name", but "dsn=name"!!! If you have trouble, look into ~/odbc.trace If you don't have trouble, continue reading...</p>\r
-<p>Congratulations, now everything should work fine :) </p>\r
-<p>I hope I saved you couple of days, which I spent looking for this information.</p>\r
-\r
-<p><b>The following additional notes were supplied by Dick Wieland</b></p>\r
-<p>- The iODBC documentation species HOST, not SERVERNAME as the parameter used to\r
-designate the remote server. If you use HOST, the odbctest program returns with nothing more than \93Have a nice day\94.</p>\r
-<p>- The iODBC documentation lists /usr/local/etc as the default location for odbc.ini. /etc is the default location.</p>\r
-\r
-</p>\r
-\r
-</body>\r
-</html>
\ No newline at end of file