1

I am trying to set up a new postgres odbc connection for an application.

This is done on 32-bit Windows 7 system. I installed latest postgresql 9.6 & psqlodbc 0905, and there were no errors. When I add the odbc connection string and test connectivity with postgres login, it fails with the following error:

Test connection failed because of an error in initialized provider. Specified driver could not be loaded due to system error 182: (PostgreSQL UNICODE, C:\Program Files\psqlODBC\0905\bin\psqlodbc35w.dll)

Here's the connection string:

Driver={PostgreSQL UNICODE};Server=127.0.0.1;Port=5432;Database=postgres; Uid=postgres;Pwd=postgres;

I then installed Visual C++ redistributable packager versions 2008 and 2010 later. Rebooted the box. Still same issue.

Postgres + odbc + other installs were complete and without any errors.

This is getting too frustrating.

Please.. any ideas on how to fix this will be helpful.?!

Update: I have tested the following: 1. Installed older postgres & psdqlodbc version 2. Added psqlodbc path to PATH env variable at the start 3. Uninstalled standalone psqlodbc installs, and installed Stackbuilder from postgresql package to download and install psqlodbc component.

All of these have not not been any useful.

Final Update: I was able to fix this by using psqlodbc_09_03_0400. For whatever reason, other versions kept throwing error.

2 Answers 2

2

Apparently, according to the Microsoft index of error codes, error 182 means ERROR_INVALID_ORDINAL, which with the help of this answer I believe means that the postgresql ODBC driver is loading another DLL and trying to call a function within it that does not exist.

The most likely cause for this would be that the system is loading a wrong version of a DLL on which psqlodbc depends. In fact I found this thread where someone else was having the same issue (although back in 2005).

This could happen if you had installed some other package containing one of the DLLs that psqlodbc relies on, or maybe even another version of psqlodbc.

Try changing the windows search path to put the directory containing the psqlodbc drivers at the front to confirm if this is the case. If that works you might want to try to narrow the problem down until you can find exactly what DLL is conflicting, and if possible remove it.

It is also possible that there is some packaging issue with the psqlodbc package you are using - if that is the case you could try uninstalling that one and installing an earlier version.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks @harmic. I checked those answers and have already tried adding the path to psqlodbc dir first, & installed older versions of both psqlodbc and postgres. From the debugger log, ordinal error is confirmed - Exception C0000138 (ORDINAL NOT FOUND). No change in error. Still can't add the odbc conn..
@Sunshine could you add the debugger log to your question? Also you might want to turn on LoadLibrary debugging, as mentioned on this page: blogs.msdn.microsoft.com/junfeng/2006/11/20/…
It seems that there is an issue with newer psqlodbc installs. After several attempts, I picked up another older version - psqlodbc_09_03_0400 - and it worked! Don't know why, bcos, prior to this, I had already tried multiple other psqlodbc versions which didn't work. Thanks for your suggestions. I appreciate it....
2

Final Update: I was able to fix this by using psqlodbc_09_03_0400. For whatever reason, other versions kept throwing error.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.