Thread: ODBC Support

ODBC Support

From
"Paul Simpson"
Date:
Hi,
 
I've been playing with ODBC (some of you have been good enough to answer some of my questions already - thanks) and have come up against an "interesting" issue.
 
I am running SlackWare 9.1 with PostgreSQL 7.4.1. I purchased a book by Ewald Geschwinde and Hans-Jurgen Schonig called "PostgreSQL Developers handbook" (published by SAMS).
 
Anyway, in a section on ODBC (page 439 if you have the book) it says that for ODBC support, you need to compile with the option --with-odbcinst. It then says you need to import a file called "odbc.sql" into template1. Given some odd problems I have been having with using ODBC, I wondered if this is my problem.
 
I have done the first of these steps without getting an error (at least, not one I could see!) but I still cannot find the odbc.sql file in my src directory.
 
As I see it, one of three situations exist:-
 
1. The book is out of date and the newer version doesn't need this.
2. The book is wrong
3. I am wrong.
 
Of the three, I suspect the last is the most likely!
 
Can anyone offer any suggestions as to what I should be doing?
 
Many thanks.
 
Paul Simpson
 

Re: ODBC Support

From
Jeff
Date:
On Mar 15, 2004, at 7:49 AM, Paul Simpson wrote:

> Anyway, in a section on ODBC (page 439 if you have the book) it says
> that for ODBC support, you need to compile with the option
> --with-odbcinst. It then says you need to import a file called
> "odbc.sql" into template1. Given some odd problems I have been having
> with using ODBC, I wondered if this is my problem.
>

What you want is the psqlodbc driver available from
http://gborg.postgresql.org/project/psqlodbc/projdisplay.php

Note: If you are using it on unix it is not threadsafe! (But it is
threadsafe on win)

Also, the only thing odbc.sql does is add common odbc functions.  It is
not needed for you to use odbc.

good luck.

--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/


Re: ODBC Support

From
Tom Lane
Date:
"Paul Simpson" <Paul.Simpson@spgs.org> writes:
> I am running SlackWare 9.1 with PostgreSQL 7.4.1. I purchased a book by Ewa=
> ld Geschwinde and Hans-Jurgen Schonig called "PostgreSQL Developers handboo=
> k" (published by SAMS).
> =20
> Anyway, in a section on ODBC (page 439 if you have the book) it says that f=
> or ODBC support, you need to compile with the option --with-odbcinst.

ODBC support isn't part of the main Postgres project anymore --- you
need the separate postgresql-odbc package, as well as unixODBC (but
you've always needed the latter).  If you don't find these packages
in your distribution, you can get source from the odbc project at
gborg.postgresql.org.

            regards, tom lane

Re: ODBC Support

From
"Paul Simpson"
Date:
Jeff, Tom,
 
Thank you for your responses. Perhaps I need to clarify.
 
I'm trying to run a windoze front-end application (which I didn't write) against a PostgreSQL back-end. So I presume it's the Windoze ODBC drivers I need (I have these, although it would seem that there are several varieties available - is there a list around anywhere?).
 
I have been having all sorts of issues with getting the beast to work, which I was hoping this procedure would fix.
 
Do I understand it that the extra config. option simply provides ODBC client drivers on the *nix platform? If so, then I don't think I need them because I'm not connecting from the *nix box (is that correct?)
 
The odbc.sql file - since I didn't write the app, it is quite possible that it uses odbc functions which are considered "standard" without my knowledge. I'd certainly like to rule this out as the cause of my problems. Where can I get hold of this file? I need Postgres to behave in as standard an odbc way as possible.
 
Thanks again,
 
Paul Simpson

Re: ODBC Support

From
Tom Lane
Date:
"Paul Simpson" <Paul.Simpson@spgs.org> writes:
> Thank you for your responses. Perhaps I need to clarify.

> I'm trying to run a windoze front-end application (which I didn't
> write) against a PostgreSQL back-end. So I presume it's the Windoze ODBC
> drivers I need (I have these, although it would seem that there are
> several varieties available - is there a list around anywhere?).

You also need the Postgres-specific low-level drivers for Windows;
again these are available from the psqlodbc project.  However, you
are getting way off topic for pgsql-general (not to mention way past
my knowledge of how to configure ODBC on Windows).  I'd suggest
reviewing the info available at
http://gborg.postgresql.org/project/psqlodbc/projdisplay.php
and asking any further questions on the pgsql-odbc mailing list.

            regards, tom lane

Re: ODBC Support

From
Frank Finner
Date:
On Mon, 15 Mar 2004 11:02:10 -0500 Tom Lane <tgl@sss.pgh.pa.us> sat down, thought long and then
wrote:

> "Paul Simpson" <Paul.Simpson@spgs.org> writes:
> > Thank you for your responses. Perhaps I need to clarify.
>
> > I'm trying to run a windoze front-end application (which I didn't
> > write) against a PostgreSQL back-end. So I presume it's the Windoze ODBC
> > drivers I need (I have these, although it would seem that there are
> > several varieties available - is there a list around anywhere?).
>
> You also need the Postgres-specific low-level drivers for Windows;
> again these are available from the psqlodbc project.  However, you
> are getting way off topic for pgsql-general (not to mention way past
> my knowledge of how to configure ODBC on Windows).

After installation of these MSW-ODBC drivers configuration is quite straightforward: Not much more
than entering server, database, user, password, in the usual ODBC creation area is needed, and the
whole thing is running. We use it since about two years without any problems for transferring data
from PostgreSQL (web application) to Centura, Oracle and some other databases we (have to) use on
MSW.

Regards, Frank.