Thread: Fw: BUG #5640: ODBC driver installed but not found

Fw: BUG #5640: ODBC driver installed but not found

From
"Hannu Pohjanpalo"
Date:
Thanks Craig for your answer, and sorry for a late response. I did try the
 c:\windows\system32\odbcad32 program, and pressed Add... but it does not
 show any postgreSQL drivers. The driver I got installed by running
 Application Stack Builder 2.1.0 is psqlODBC v09.04.0200-1, and it was
 installed in both c:\Program Files\psqlODBC\0804\bin and in c:\Program
Files
 (x86)\psqlODBC\0804\bin.

 I then looked at the registry and found that in
 HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI there were only these two
 SQLServer entries but no postgreSQL entries (like there is in my Vista PC,
 where the ODBC works fine). I edited the keys and values there, as copies
 from the Vista PC, but that did not help. - Finally I found the PostgreSQL
 entries in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI, but
 obviously odbcad32.exe cannot find them no matter where these keys are.

 Anyway, the database works well via pgAdmin III, but the ODBC does not. I
 cannot setup a data source with odbcad32. I hope this info above helps you
 understand what might be wrong. Has anyone got the ODBC working in a
Windows 7 Pro 64 bit?

 Hannu

 ----- Original Message -----
 From: "Craig Ringer" <craig@postnewspapers.com.au>
 To: "Hannu Pohjanpalo" <hannu.pohjanpalo@winware.fi>
 Cc: <pgsql-bugs@postgresql.org>
 Sent: Friday, September 03, 2010 6:20 AM
 Subject: Re: [BUGS] BUG #5640: ODBC driver installed but not found


> On 3/09/2010 2:36 AM, Hannu Pohjanpalo wrote:
>
>> I installed PostgreSQL 8.4.4 in my Windows 7 Professional (64 bit), and
>> ran
>> (as Administrator)Application Stack Builder to download and install the
>> ODBC
>> driver. This installation looked perfectly successful, but when starting
>> Control Panel / Administrative Tasks / ODBC Settings, and press Add..., I
>> cannot find this PostgreSQL ODBC driver, I can only see two SQLServer
>> drivers. I uninstalled and tried again: same result. Have you seen this
>> before? All ideas are welcome, thanks!
>
> You have to run the 32-bit ODBC administrator. PostgreSQL doesn't install
> a 64-bit ODBC driver yet, and anyway you'd need to configure the 32-bit
> one for access by any 32-bit apps.
>
> --
> Craig Ringer
>
> Tech-related writing at http://soapyfrogs.blogspot.com/
>
>

Re: BUG #5640: ODBC driver installed but not found

From
Craig Ringer
Date:
On 8/09/2010 12:53 AM, Hannu Pohjanpalo wrote:

 > I did try the
 > c:\windows\system32\odbcad32 program, and pressed Add... but it does
 > not show any postgreSQL drivers.

That's the 64-bit version of the ODBC administrator. Yes, that's
confusing. The name is a holdover from the 16-bit to 32-bit Windows
transition, when "odbcadm" was the 16-bit version and a new 32-bit
versoin "odbcad32" was provided.

Apparently many apps and installers depend on odbcad32.exe having that
name and path, so Microsoft landed up being stuck with it despite the
stupid name. It's the same reason the "system32" directory is still
called that on 64-bit Windows.

See: http://support.microsoft.com/kb/942976

You'll see in that article that the 32-bit ODBC administrator is:

    %systemdrive%\Windows\SysWoW64\odbcad32.exe

(which you can launch from "Start->Run" using the path above). You need
to use the 32-bit ODBC administrator to set up data sources for 32-bit
applications using 32-bit drivers.

That MSDN article also appears to say that you *cannot* use a 32-bit
ODBC driver in a 64-bit application. That means that you'll still only
be able to use the PostgreSQL ODBC driver with 32-bit applications until
a 64-bit ODBC driver is released. Apparently there's now 64-bit support
in the psqlODBC sources:

http://www.mail-archive.com/pgsql-announce@postgresql.org/msg01822.html

Perhaps this needs to go in the psqlODBC FAQ?

http://psqlodbc.projects.postgresql.org/faq.html

Anyway: what app(s) do you want to use PostgreSQL with over ODBC? Are
they 32-bit or 64-bit builds?

> I then looked at the registry and found that in
> HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI there were only these two
> SQLServer entries but no postgreSQL entries (like there is in my Vista PC,
> where the ODBC works fine).

Your vista machine - is it a 32 bit or 64 bit version of Vista? I'm
guessing 32-bit.

 > Finally I found the PostgreSQL
> entries in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI, but
> obviously odbcad32.exe cannot find them no matter where these keys are.

AFAIK that's the right place for the registry entries. They're 32 bit
drivers, so they can't be used directly by 64-bit code, they have to run
via the wow64 layer.

> Anyway, the database works well via pgAdmin III, but the ODBC does not.

That's because pgAdmin III uses libpq directly, it doesn't use ODBC.
That's also why you don't have to mess around configuring data sources.

 > Has anyone got the ODBC working in a Windows 7 Pro 64 bit?

I don't use 64-bit Windows. I haven't seen many reports either way here,
but perhaps there's more discussion of it on the EnterpriseDB web
forums: http://forums.enterprisedb.com

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/