Forum > Databases

TPQConnection and auth for scram-sha-256 or md5

(1/1)

noszone:
I have installed Postgresql 13 and connection from this DB only possible with auth method trust. So TPQConnection does not requires any password (through some old libpq.dll, which says "auth method 10 is not supporting" if I change it in ph_hba.conf), but I need for our Lazarus app the auth by password.

I've tried to use a bunch of files from PG 13, PG10 installations - both x32 & x64 dlls, but no luck. Does anyone know if TPQConnection (or other component maybe?) supporting PG 13 with auth scram-sha-256 or md5 by password?

The files I tried to use:
From PG10 x32 and from PG13 installed on my pc from bin folder:

libcrypto-1_1-x64.dll
libiconv-2.dll
libintl-8.dll
libpq.dll
libssl-1_1-x64.dll

Please help..

Additionally adding some shots (1st is debug mode, 2nd is exe run).

noszone:
Solved, helped to me to put a PATH system variables:

C:\Program Files\PostgreSQL\13\bin
C:\Program Files\PostgreSQL\13\lib

This in case if your Lazarus App is x64. If you want run x32 Laz App, so you have to provide to PATH a x32 binaries (dlls):

D:\PG\13\bin
D:\PG\13\lib

Binaries can be downloaded (the last x32 binaries is PG 10v) - https://www.enterprisedb.com/download-postgresql-binaries

Alternative way (not requires PATH variables):

Open your project *.lpr file in any text editor, you will see:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program project1; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms, Unit1  { you can add units after this }; {$R *.res} begin  RequireDerivedFormResource:=True;  Application.Scaled:=True;  Application.Initialize;  Application.CreateForm(TForm1, Form1);  Application.Run;end. 
Modify it to:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program project1; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms, Unit1  { you can add units after this }; function SetDllDirectory(lpPathName:PWideChar): Boolean; stdcall; external 'kernel32.dll' name 'SetDllDirectoryW'; {$R *.res} begin  SetDllDirectory(PWideChar('D:\Sources\tst'));  RequireDerivedFormResource:=True;  Application.Scaled:=True;  Application.Initialize;  Application.CreateForm(TForm1, Form1);  Application.Run;end.
So in the folder path you can put your dlls from Postgres. Note that it's will work only in run-time mode. For debug mode you still need a PATH variables.

Navigation

[0] Message Index

Go to full version