distal-attribute
distal-attribute
distal-attribute
distal-attribute

Cannot find a usable libpq.dll

codecaptain posted 2 years ago in Creating a connection
I'm trying to connect to a PostgreSQL database on a network server.

I've done the following things:
- installed PostgreSQL on my Windows 7 machine
- restarted my machine
- downloaded the latest version of HeidiSQL (9.2.0.4947)
- copied the libpq.dll from C:\Program Files\PostgreSQL\9.4\lib\ to C:\Program Files\HeidiSQL\
- launched HeidiSQL from C:\Program Files\HeidiSQL\

Yet I'm still getting the following error message:
Cannot find a usable libpq.dll. Please launch heidisql.exe from the directory where you have installed it.

How do I get HeidiSQL to connect to a PostgreSQL database on a network server without getting this error?
codecaptain posted 2 years ago
Bump...
ansgar posted 2 years ago
Looks like you did not install HeidiSQL properly. That libpq.dll (32/64bit version, depending on your OS) is installed in the right directory when using the HeidiSQL installer. Of course the portable ZIP file also contains a working libpq.dll.

You should not be required to copy some other .dll file to HeidiSQL's folder.
codecaptain posted 2 years ago
I uninstalled HeidiSQL via the Control Panel in Windows 7. I verified that C:\Program Files\HeidiSQL\ folder was removed. I then reinstalled using the installer I downloaded from http://www.heidisql.com/installers/HeidiSQL_9.2.0.4947_Setup.exe.

After that, I launched HeidiSQL and got the following window. It still says that PostgreSQL is experimental (see attachment 1). And I still get the same error as shown in attachment 2.

How do I install HeidiSQL so that I can connect to PostgreSQL?
2 attachment(s):
  • heidi1
  • heidi2
codecaptain posted 2 years ago
Anyone?
ansgar posted 2 years ago
Probably that libpq.dll is blocked by your antivirus software?
I don't know. You could try on another machine.
belackriv posted 1 year ago

I'm running into this issue on a fresh install of Win10 (worked on the previous win10 upgrade).

ansgar posted 1 year ago

Please look into the folder where you installed HeidiSQL, and watch out if there is a libpq.dll. If no, then the installer did something wrong. But I guess that is some issue with file privileges.

belackriv posted 1 year ago

I looks like if you use the installer on a 64-bit machine it installs the 64bit-version, but libpq.dll is not a 64-bit version. I used the portable zip and was able to get it to run the 32 bit version.

ansgar posted 1 year ago

That would mean PostgreSQL would not work on any 64bit machine. Can't believe that, but I can check that.

Which version of the installer did you use?

belackriv posted 1 year ago

Probably the wrong one =D (HeidiSQL_9.3.0.4984_Setup.exe).

belackriv posted 1 year ago

Well, I just tried the "HeidiSQL_9.3.0.5049_Setup", same issue. However, if I put "heidisql32.r5049.exe" in the folder and run it, it works, but but the 64 bit version. The 32 version crashes on exit though.

date/time          : 2016-02-09, 08:09:50, 887ms
computer name      : DEVELOPER-VS
user name          : Caleb-VS
operating system   : Windows 10 x64 build 10586
system language    : English
system up time     : 6 days
program up time    : 8 seconds
processors         : 8x Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz
physical memory    : 5486/16296 MB (free/total)
free disk space    : (C:) 96.10 GB
display mode       : 1536x864, 32 bit
process id         : $2e08
allocated memory   : 43.66 MB
largest free block : 1.12 GB
executable         : heidisql32.r5049.exe
exec. date/time    : 2016-02-09 08:05
version            : 9.3.0.5049
compiled with      : Delphi XE5
madExcept version  : 4.0.12
callstack crc      : $56492c7f, $c70d16f6, $c70d16f6
exception number   : 1
exception class    : EAccessViolation
exception message  : Access violation at address 56492C7F in module 'libpq.dll'. Write of address 001A0010.

main thread ($3f28):
56492c7f libpq.dll
564920ca libpq.dll                                     PQfinish
0083cb06 heidisql32.r5049.exe dbconnection    1960 +47 TPgConnection.SetActive
0094a844 heidisql32.r5049.exe Main            2051 +52 TMainForm.ConnectionsNotify
0040c978 heidisql32.r5049.exe System           196  +0 DynArraySetLength
008616a2 heidisql32.r5049.exe dbconnection      38  +0 {System.Generics.Collections}TList<dbconnection.TDBConnection>.Notify
00862317 heidisql32.r5049.exe dbconnection     728  +0 {System.Generics.Collections}TObjectList<dbconnection.TDBConnection>.Notify
00861eb0 heidisql32.r5049.exe dbconnection     728  +0 {System.Generics.Collections}TList<dbconnection.TDBConnection>.DeleteRange
00861508 heidisql32.r5049.exe dbconnection      38  +0 {System.Generics.Collections}TList<dbconnection.TDBConnection>.SetCount
0067b8a1 heidisql32.r5049.exe Vcl.Forms                TCustomForm.DoDestroy
0067b6f2 heidisql32.r5049.exe Vcl.Forms                TCustomForm.Destroy
004a6a99 heidisql32.r5049.exe madExcept                InterceptClassDestroy
004084b0 heidisql32.r5049.exe System           196  +0 TObject.Free
0053a47f heidisql32.r5049.exe System.Classes           TComponent.DestroyComponents
00679481 heidisql32.r5049.exe Vcl.Forms                DoneApplication
0044c3a1 heidisql32.r5049.exe System.SysUtils          DoExitProc
00409fe9 heidisql32.r5049.exe System           196  +0 @Halt0
00986a8d heidisql32.r5049.exe heidisql          80 +26 initialization
766e38f2 KERNEL32.DLL                                  BaseThreadInitThunk
ansgar posted 1 year ago

Yes, that's a known issue in the 32bit version of heidisql.exe/libpq.dll. So, that's normal for now. The important thing is you have the 32bit version of libpq.dll while you had the 64bit version of heidisql.exe before, which cannot run obviously. Glad you found the right file :)

ansgar posted 1 year ago

See http://www.heidisql.com/forum.php?t=21039 and r5068 - updating to the latest build should fix these "cannot find a usable libpq.dll".

ansgar posted 1 year ago

Forgot to say: You need to install the latest installer, because it contains some updated and one new dll. So, just updating to the latest heidisql.exe will not do it.

hemraj posted 1 year ago

please put the heidisql32.r5049.exe file in the folder which contains .dll file in the db installation directory

gxtaillon posted 7 months ago

This still occurs on windows 7 sp1 using the 32+64bit (yyyy_Setup.exe) installer. Uninstalling and reinstalling does not fix this. Neither does adding the HeidiSQL directory to the path and restarting. Only the yyyy-32_Setup.exe one works. Just tested this again with 9.4.0.5133 (latest nightly).

ansgar posted 7 months ago

Are you sure the latest build still yields this error?

Cannot find a usable libpq.dll

Please see my change in r5132:

Try to load libpq.dll with explicit file path if the path-less did not succeed. See http://www.heidisql.com/forum.php?t=22514

JimTheFrog posted 7 months ago

I'm seeing this error (on build 9.4.0.5139). It might result from trying to connect to a PostgreSQL server (Amazon Redshift) without specifying a database name in the session, but I can't consistently replicate that.

Log window says / Trying to load library with full path: C:\Program Files\HeidiSQL\libpq.dll /. The DLL file is there.

No errors connecting to a few different MySQL servers.

Running Windows 10 Pro (build 14393) on 64-bit Dell Precision M3800.

ansgar posted 7 months ago

You could uninstall Heidi, and erase the entire directory C:\Program Files\HeidiSQL\, just to be sure no dlls are left. Then do a fresh install with the latest version and try again.

roseawebs posted 7 months ago

Probably that libpq.dll is blocked by your antivirus software? I don't know. You could try on another machine. Thanks @ansgar. Same problem was happening with me. After deactivate my antivirus problem was solved.

jschmitt posted 3 months ago

I've been struggling with this as well.

I've used ProcMon and traced the issue to not having MSVCR120.dll. Upon installing "Microsoft Visual C++ 2013 Redistributable" (v 12.0.xxxx); HeidiSQL +PostgreSQL works.

Please login to leave a reply, or register at first.