#1 2022-08-25 12:56:00

flydev
Member
From: France
Registered: 2020-11-27
Posts: 50
Website

TryLoadLibray PostgreSql lib

Hi,

I'am scratching my head with this. 

ESqlDBPostgres {Message:"TSqlDBPostgresLib.TryLoadLibray failed - searched in C:\\Users\\flydev\\Documents\\Embarcadero\\Studio\\Projets\\SagasEnv\\RemoteBlock2\\bin2\\libpq.dll, libpq.dll",Statement:null}

I installed Postgres 14, copied the libs (crypto, iconv, libintl, libssl, zlib and libpq.dll) in the same directory of the executable, I tried to add as well this dir on env PATH, but nothing.

Is there something special to do ?


---

Edit:  Just added `C:\Program Files\PostgreSQL\14\bin` to the env PATH and it's working..

Last edited by flydev (2022-08-25 12:58:47)

Offline

#2 2022-08-25 16:07:39

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 330

Re: TryLoadLibray PostgreSql lib

Are you using 32-bit? Postgres14 comes only with a 64-bit client

Offline

#3 2022-08-25 17:05:19

flydev
Member
From: France
Registered: 2020-11-27
Posts: 50
Website

Re: TryLoadLibray PostgreSql lib

@daniel thanks, indeed the executable is compiled in 64bit. I double checked with a PE tool after compilation.

I must add FYI, that I tried to load the lib with this simple call

var Handle := LoadLibrary('libpq.dll');
if Handle <> 0 then
  WriteLn('OK')
else
  WriteLn('BAD');

and it return 'BAD'  sad
with the env PATH modified, it return 'OK'.

I also read the whole following thread found on Lazarus forum: https://forum.lazarus.freepascal.org/in … 4cpaer7mh3


I will come back for sure to this issue as the solution to modify the ENV path like in my first message is only viable for my local dev environment.

Last edited by flydev (2022-08-25 17:18:50)

Offline

#4 2022-08-25 18:54:18

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,539
Website

Re: TryLoadLibray PostgreSql lib

For mROMot1 there is global variable  SynDBPostgresLibrary in unit SynDBPostgres - set it to libpq.dll location (for example SynDBPostgres := 'D:/PostgreClient/10/x64/bin/libpq.dll') and all should woks without playing with PATH.
BTW PostgreSQL on Windows works extremely bad - it designed for Linux

Last edited by mpv (2022-08-25 18:55:13)

Offline

#5 2022-08-30 19:26:46

radexpol
Member
From: Poland, Krk
Registered: 2019-11-29
Posts: 116

Re: TryLoadLibray PostgreSql lib

I used Microsoft Sysinternals Procmon.exe to find what files my project is looking for and what files are missing, that helped me to find all dll files required by PostgreSQL (7 dlls AFAIR)

Offline

#6 2022-09-01 08:30:30

flydev
Member
From: France
Registered: 2020-11-27
Posts: 50
Website

Re: TryLoadLibray PostgreSql lib

I didn't think about that at all. Thanks you ! Will share the result / solution smile

mpv wrote:

BTW PostgreSQL on Windows works extremely bad - it designed for Linux

Thanks for insight, indeed, I am migrating the infrastructure on Unix server as Windows Server only bring me problems, especially with database servers.

Last edited by flydev (2022-09-01 08:33:46)

Offline

Board footer

Powered by FluxBB