Libpq problem on Windows

I am just starting to use Postgres on Windows. I have Postgres installed and running. My Xojo code is patterned after the sample in the LR. When I try to connect in the debugger the exception message is

SCRAM authentication requires libpq version 10 or above

I dragged libpg.dll from the lib folder of the Postres installation into Build Step / CopyFile1 and specified the Resources Folder as I had seen a in post regarding SQLDatabaseMBS. I’m not using MBS so I only copied the one file from the error message. When I try to run the app, I get

The script ‘CopyFiles1’ can’t copy files to the destination in a pre-build step. The destination does not exist yet. This step will not be executed.

Is it possible to run Postres in the debugger?

Dragging the copyfile1 script to after the build step will fix the error, not sure about the solution though.

Even after following Wayne’s suggestion, and adding libpq.dll to the library, it still did not work. I deleted PostgreSQL 13 from the computer and installed PostgreSQL 11 and everything works as it should. I will file a bug report that the Postgres plugin needs to be updated.

I am running v13 on my server & accessing it without issues on my dev machine, so the issue has to be a postgres configuration problem not the plugin.

SCRAM needs newer lib. Probably Wayne circumvented the authentication problem using the old method, changing the v10+ SCRAM (Salted Challenge Response Authentication Mechanism) to the less safer MD5 on pg_hba.conf

Notice your authentication must be compatible with the current stored encrypted one, or before trying it again, you must change the encryption method (password_encryption) and change the desire password (psql command \password) to store a new correct one.

Hi Wayne !

I have the same problem.
Could you share with me the steps to follow so I can make XOJO work with Postgres 13?

Thanks!

Hi Jose,

I’m not a postgres expert and indeed mostly use MSSQL server. In this case I simply downloaded the latest version of postgres onto my server, edited the config file so I could connect from pgadmin on my dev machine and once that was done connected from Xojo.

I’ll attempt to make a movie showing the steps over the next couple of weeks, but by the looks of the comments I’m probably not using the latest security mechanisms.

I’m relying on my firewall to protect the data and as my network is me I’m pretty sure it’s safe :slight_smile:

As I struggled with the same issue, here is what I did to get it run:
a) Going to C:\Program Files\PostgreSQL\13\data

b) opening pg_hba.conf in the above directory and change the following lines from:

IPv4 local connections:

host all all 127.0.0.1/32 scram-sha-256

IPv6 local connections:

host all all ::1/128 scram-sha-256
to:

IPv4 local connections:

host all all 127.0.0.1/32 md5

IPv6 local connections:

host all all ::1/128 md5

c) opening postgresql.conf in the above directory and changing the following line from:
password_encryption = scram-sha-256
to:
password_encryption = md5

d) logging in the database server with HeidiSQL (Free Software) and running the comand:
ALTER USER postgres WITH PASSWORD ‘new password’
This you have to do with all previous created users you want to access from Xojo.

Now you shoud be able to login via Xojo

I forgot, you must restart the posgre server after making the changes to the *.conf files. Two possibilities is the Computer Management → Service Console or to restart the computer.

this worked for me to downgrade scram to md5.
it is less secure, but it works… :wink: