egnew 5 Posted Sunday at 12:02 AM I installed Postgresql and am unable to connect to the database. I get the following error when I execute the program and attempt to connect to my database. My 64 bit program is set for debug and contains a TFDConnection with the appropriate parameters. Copying libpq.dll from c:\Program Files\PostgreSQL\17\bin into the win64\debug folder did not work. Adding c:\Program Files\PostgreSQL\17\bin to the system path also does not work. What do I need to do to resolve this issue? Thanks Share this post Link to post
egnew 5 Posted Sunday at 01:21 AM The issue was resolved using a FDPhysPgDriverLink with VendorLib set to the folder containing the libpq.dll. Is FireDac no longer using the path or executable directory for DLL files? 1 Share this post Link to post
weirdo12 20 Posted Sunday at 06:21 PM 18 hours ago, egnew said: Copying libpq.dll from c:\Program Files\PostgreSQL\17\bin into the win64\debug folder did not work. In my experience, putting libpg.dll and its dependencies in debug\lib and release\lib works and eliminates having to specify a folder in the driver componenent. Share this post Link to post
egnew 5 Posted Sunday at 09:42 PM Thanks. Placing the DLL in the executable directories is the first thing I tried. It works for every other DLL I use. It did not work at all with libpq.dll. When I release the application, libpq.dll will be in the executable directory. I am using Embarcadero® RAD Studio 12 Version 29.0.51961.7529. Delphi 12 Update 1 with Rad Studio 12.1 Patch 1. Windows 11 version 23H2 OS Build 22631.4460, 64-bit edition. Share this post Link to post
weirdo12 20 Posted Sunday at 09:55 PM 5 minutes ago, egnew said: When I release the application, libpq.dll will be in the executable directory. I found that the library files had to be in a sub-directory named lib but that may have changed since I originally started supporting PostgreSQL. I use 12.2 now and just put the files in Debug\lib and Release\lib out of habit. Share this post Link to post
weirdo12 20 Posted Sunday at 10:02 PM The other thing to remember is that you need to have the 32-bit version of the Visual Studio run-time library installed or the 32-bit PostgreSQL libraries won't work. https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2013-vc-120 Share this post Link to post
Pat Heuvel 1 Posted Sunday at 10:53 PM The message "Cannot load vendor library libpq.dll" is a little misleading. What I reckon is happening here is that libpq's dependencies cannot be found. If you want to run with libpq in your executable's directory, you also need: libintl-8.dll libcrypto-3-x64.dll libssl-3-x64.dll These files can be found in the runtime directory of the latest pgadmin.exe or postgresql. For an earlier version of libpq, these dependencies were: libeay32.dll libssl32.dll Don't ask me when the versions changed! Also, don't forget the MS VC runtime mentioned elsewhere! Hope this helps, Regards, Pat Share this post Link to post
weirdo12 20 Posted Sunday at 11:10 PM In case you need the final 32-bit version of PostgreSQL to get the correct libraries, here is a link: https://get.enterprisedb.com/postgresql/postgresql-10.23-1-windows.exe 1 Share this post Link to post
egnew 5 Posted Monday at 01:52 PM I would like to thank everyone for their ideas but I posted a solution less than two hours after my original post. The solution is to set the VendorLib property of a TFDPhysPGDriverLink. var v_pointer: Pointer; begin if SizeOf(v_Pointer) = 4 then FDPhysPGDriverLink1.VendorLib := 'C:\PostgreSQL\odbc32\bin\libpq.dll' else FDPhysPGDriverLink1.VendorLib := 'C:\Program Files\PostgreSQL\17\bin\libpq.dll'; I initially tried putting the appropriate DLLs in the application debug and release folders without success. I expected that to work as it does with other 3rd-party DLLs. But It does not work with FireDAC on my machine. I have encountered a number of issues with FireDAC and it is not surprising that I needed to use a DriverLink to resolve the issue. I will no longer follow this topic as I have provided a simple and effective solution. Share this post Link to post