QPSQL: authentication method 10 not supported
-
I'm using PyQt6 (version 6.4.0) with Python 3.11, but I think my problem concerns Qt rather than the Python binding.
When I run the test script below on Windows 10, using either Python 3.11 or Python 3.10, I get this:
DEBUG:root:addDatabase: - this is ok, no error
DEBUG:root:setDatabaseName, setHostName: - and so is this
ERROR:root:db.open(): authentication method 10 not supported
QPSQL: Unable to connectPostgreSQL 15 runs on the same machine. Running the script from a virtual machine with ArchLinux everything works as expected (of course in that case I need the real host name, not 'localhost'). The PostgreSQL bin and lib directories are in the PATH. There are no older PostgreSQL versions on the machine and no older versions of PyQt / Qt.
One thing seems clear: "authentication method 10" is the password authentication using scram-sha-256 which is PostgreSQL standard from version 14 and supported from version 10. So this problem is probably not new. I'm using QtSql more with SQLite, so I didn't see it earlier.
I found some answers for the error message, but nothing concerning Qt or PyQt. The answers all talk about old versions of libpq.dll, but I installed PyQt6 with its dependencies after Python 3.11 was released, only about a week ago. So where would I search for an old version and why should it be used by Qt?
Test script (needs valid database name, user name and password, of course):
#!/usr/bin/env python3 import logging from PyQt6 import QtCore from PyQt6 import QtSql def createConnection(): db = QtSql.QSqlDatabase.addDatabase("QPSQL") logging.debug("addDatabase: %s", db.lastError().text()) db.setDatabaseName("xxx") db.setHostName("localhost") logging.debug("setDatabaseName, setHostName: %s", db.lastError().text()) db.setUserName("xxx") db.setPassword("xxx") return db def test(): logging.basicConfig(level=logging.DEBUG) app = QtCore.QCoreApplication([]) db = createConnection() result = db.open() if result: print("Datenbankverbindung offen.") else: logging.error("db.open(): %s", db.lastError().text()) if __name__ == "__main__": test()
-
@skoczian
I would imagine thelibpq.dll
you are using supports older methods of authentication and not this "method 10". The fact that you have installed a recent Python/PyQt/Qt may not alter this fact.If @Christian-Ehrlicher sees this post, I believe he uses PostgreSQL and may be able to comment/help....
-
@skoczian said in QPSQL: authentication method 10 not supported:
libpq.dll
Can you find out the version of the library (right click -> properties)?
In the meanwhile modify your config to use md5 instead the 'new' authenthication method as described here.
-
I have this problem, too.
I'm new to postgres, Installed latest version 3 days ago on my laptop.
so my libpq.dll should be the newest available (15.0.1.22312).
I use VisualStudio (newest version) writing a little C#-Program,
just to connect to a postgres-db and executing a stupid select...
I don't know what to do. -
@drhammer said in QPSQL: authentication method 10 not supported:
writing a little C#-Program
How is this related to Qt then?
-
@Christian-Ehrlicher said in QPSQL: authentication method 10 not supported:
@skoczian said in QPSQL: authentication method 10 not supported:
libpq.dll
Can you find out the version of the library (right click -> properties)?
In the meanwhile modify your config to use md5 instead the 'new' authenthication method as described here.
The libpq.dll belonging to PostgreSQL has version 15.0.1.22312. I searched the machine for another, older version that might be used by Qt, but didn't find anything.
I don't think I'll change the authentication method of PostgreSQL - that's putting the cart before the horse in my view. Writing a GUI with PyQt and using psycopg for database access instead of QtSql is quite possible. And psycopg definitely works with PostgreSQL 15.
But it's interesting that C# or .NET seems to have the same problem!
-
@skoczian said in QPSQL: authentication method 10 not supported:
I don't think I'll change the authentication method of PostgreSQL - that's putting the cart before the horse in my view.
It was meant
a) as a test if it helps
b) as a workaroundBut do whatever you like.
-
For me it works now:
In an C# / .NET / VisualStudio - Environment it has something to do with the Npgsql.dll.
This is a wrapper for the MS ADO-Interface.
I think it is not very stable yet. They released a new version a few days ago, I installed it and now it works (but still have problems with converting results ...).Concerning Qt I don't know at the moment. -
@Christian-Ehrlicher said in QPSQL: authentication method 10 not supported:
It was meant
a) as a test if it helpsTrue, that should have given more information - but now the fog is even denser. The result, with the same test script: same error message with md5 in all the "host" or "local" records in pg_hba.conf, after restart of PostgreSQL. It works as expected with "trust" in the same places.
I should perhaps add that I don't use QtSql with PostgreSQL databases in earnest. I just have some test scripts - and it's quite possible that I didn't run them for every new PostgreSQL or PyQt version.
I've had problems with QtSql using PostgreSQL or Interbase/Firebird before, but this is the first time I couldn't even find a bug report for them.