X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 001CFD1B581 for ; Sun, 16 Nov 2003 19:44:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07486-02 for ; Sun, 16 Nov 2003 15:43:55 -0400 (AST) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id A0AD6D1B565 for ; Sun, 16 Nov 2003 15:43:49 -0400 (AST) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-32.mail.demon.net with esmtp (Exim 3.35 #1) id 1ALSoH-000Axe-0W; Sun, 16 Nov 2003 19:43:49 +0000 Received: from linda.lfix.co.uk ([192.168.1.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.24) id 1ALSoD-0000IT-0Y; Sun, 16 Nov 2003 19:43:45 +0000 Subject: Re: installation of odbc From: Oliver Elphick To: Wolfgang Meiners Cc: pgsql-odbc@postgresql.org In-Reply-To: <200311161609.23665.WolfgangMeiners01@web.de> References: <200311161609.23665.WolfgangMeiners01@web.de> Content-Type: multipart/mixed; boundary="=-sb9tRQz28k+ftfWRX3JH" Organization: LFIX Limited Message-Id: <1069011794.20177.113.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Sun, 16 Nov 2003 19:43:14 +0000 X-LFIX-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/88 X-Sequence-Number: 3490 --=-sb9tRQz28k+ftfWRX3JH Content-Type: text/plain Content-Transfer-Encoding: 7bit On Sun, 2003-11-16 at 15:09, Wolfgang Meiners wrote: > So i need help in the correct installation of postgresql with odbc support. The following information is related to Debian packages. I hope you can adapt it sufficiently to cope with SUSE's differences. The template files referred to are attached. HOW TO set up odbc-postgresql with unixodbc to allow access to other Unix programs ==================================================================== 1. Install odbc-postgresql and the packages unixodbc and odbcinst1 2. Add a PostgreSQL driver to /etc/odbcinst.ini: # odbcinst -i -d -f /usr/lib/postgresql/share/odbcinst.ini.template 3. Add the template1 database (with read only access) to the default odbc.ini # cat /usr/lib/postgresql/share/odbc.ini.template >>/etc/odbc.ini Edit /etc/odbc.ini as required, to add extra databases, change the read only status and so on. 4. Add ODBC required functions to the databases that you wish to access from ODBC: # su -s /bin/bash - postgres $ for dbname in database1 database2 ... do psql -d $dbname < /usr/lib/psqlodbc/odbc.sql done If you include template1 in the list, any database created in future will automatically have these functions included when it is created. At this point, you should be able to use the ODBC access features of any application to connect to any of the listed databases. For example, in StarOffice, you can click New->Database, select the ODBC database type and browse the list of databases from /etc/odbc.ini and ~/.odbc.ini. Each user has or can have a file ~/.odbc.ini, whose structure is the same as /etc/odbc.ini. This file is read together with the /etc/odbc.ini to give a complete list of databases accessible to the user. (Of course, any access restrictions imposed by pg_hba.conf are still applicable.) You can create templates for different databases and allow users to add them to their own ~/.odbc.ini. Use the odbc.ini template file provided in /usr/lib/postgresql/share/odbc.ini.template as a model. Ignore the file /usr/lib/postgresql/lib/odbcinst.ini, which is provided by the postgresql package. It may be good for use with iodbc, but I have no experience of using that. A good and reliable way for a user to add a template to his ~/.odbc.ini without risk of damaging the file is for him to use this command: $ odbcinst -i -s -f /path/to/your/template/file Note: I have had a report that OpenOffice objects to tabs and/or whitespace in ~/.odbc.ini and /etc/odbc.ini. I have not found this problem with StarOffice 5, however. Accessing schemas ================= If you have schemas that are not in the default search path ($user, public) you have to set the search path in the connection settings of the odbc.ini file. Here's an example, where the search path must be set to prod, public: [Production] Description = Production control Driver = PostgreSQL Trace = No TraceFile = /tmp/odbc.log Database = companydb Servername = localhost UserName = userme Password = Port = 5432 Protocol = 6.4 ReadOnly = No RowVersioning = Yes ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = SET SEARCH_PATH TO prod, public -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Therefore being justified by faith, we have peace with God through our Lord Jesus Christ." Romans 5:1 --=-sb9tRQz28k+ftfWRX3JH Content-Disposition: attachment; filename=odbcinst.ini.template Content-Type: text/plain; name=odbcinst.ini.template; charset=iso-8859-15 Content-Transfer-Encoding: 7bit [PostgreSQL] Description=PostgreSQL ODBC driver for Linux and Windows Driver=/usr/lib/postgresql/lib/psqlodbc.so Setup=/usr/lib/odbc/libodbcpsqlS.so Debug = 0 CommLog = 1 --=-sb9tRQz28k+ftfWRX3JH Content-Disposition: attachment; filename=odbc.ini.template Content-Type: text/plain; name=odbc.ini.template; charset=iso-8859-15 Content-Transfer-Encoding: 7bit [PostgreSQL] Description = PostgreSQL template1 Driver = PostgreSQL Trace = No TraceFile = /tmp/odbc.log Database = template1 Servername = localhost UserName = Password = Port = 5432 Protocol = 6.4 ReadOnly = Yes RowVersioning = No ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = --=-sb9tRQz28k+ftfWRX3JH--