They asked us to write a database cursor. The topic is simple, but you need to use all sorts of database features, such as domains, UDF, triggers, stored procedures, etc. etc. As a programming language, C ++ was chosen with the wonderful Qt library.

As a DBMS, I wanted to use my favorite, until recently, MySQL, but in view of the lack of domain support in it, my choice fell on PostgreSQL (sooner or later I will transfer everything to PostgreSQL).

I was too lazy to recompile Qt, and since odbc support was initially included, I decided to use the PostgreSQL ODBC Driver. You can download it here . I put it, I just put it, only in odbcad32.exe it never appeared. I thought that the matter was in my Windows 7 x64, as it turned out later the whole thing was in **x64. **And then Google began. There were two ways to solve this problem.

Method number 1

I found a resource where it is fashionable to download a recompiled driver for 64-bit architecture . It is installed without problems, everything appears in the list of drivers. I created a DSN with the necessary settings, but when I tried to open a connection, my Qt-based application cursed that the ODBC driver architecture does not match the application architecture (I have 32-bit Qt). So this method did not suit me. And I had to look for another way.

Method number 2

Put the original ODBC driver . And then we correct the registry. Create the pgodbc.reg file with the following contents:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESOFTWAREODBCODBCINST.INIPostgreSQL Unicode]
"APILevel"="1"
"ConnectFunctions"="YYN"
"Driver"="C:\postgresodbcdlls\psqlodbc35w.dll"
"DriverODBCVer"="03.51"
"FileUsage"="0"
"Setup"="C:\postgresodbcdlls\psqlodbc35w.dll"
"SQLLevel"="1"
"UsageCount"=dword:00000001

[HKEY_LOCAL_MACHINESOFTWAREODBCODBCINST.INIODBC Drivers]
"PostgreSQL Unicode"="Installed"

The path to psqlodbc35w.dll is changed to your own.

Now the original driver is also visible in odbcad32.exe

#odbc #postgresql #windows 7

PostgreSQL ODBC driver on Windows 7 x64
2.50 GEEK