Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPSQL: authentication method 10 not supported
QtWS25 Last Chance

QPSQL: authentication method 10 not supported

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpsqlqtsql
10 Posts 5 Posters 4.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    skoczian
    wrote on 20 Nov 2022, 11:44 last edited by skoczian
    #1

    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 connect

    PostgreSQL 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() 
    
    
    J C 2 Replies Last reply 20 Nov 2022, 11:54
    0
    • S skoczian
      20 Nov 2022, 11:44

      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 connect

      PostgreSQL 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() 
      
      
      J Offline
      J Offline
      JonB
      wrote on 20 Nov 2022, 11:54 last edited by
      #2

      @skoczian
      I would imagine the libpq.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....

      1 Reply Last reply
      0
      • S skoczian
        20 Nov 2022, 11:44

        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 connect

        PostgreSQL 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() 
        
        
        C Offline
        C Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 20 Nov 2022, 13:22 last edited by Christian Ehrlicher
        #3

        @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.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        S 1 Reply Last reply 21 Nov 2022, 15:07
        2
        • D Offline
          D Offline
          drhammer
          wrote on 21 Nov 2022, 12:24 last edited by
          #4

          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.

          J 1 Reply Last reply 21 Nov 2022, 12:28
          0
          • D drhammer
            21 Nov 2022, 12:24

            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.

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 21 Nov 2022, 12:28 last edited by
            #5

            @drhammer said in QPSQL: authentication method 10 not supported:

            writing a little C#-Program

            How is this related to Qt then?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • D Offline
              D Offline
              drhammer
              wrote on 21 Nov 2022, 13:10 last edited by
              #6

              I think it has nothing to do with Qt. I stripped everything out, tried to isolate the problem.
              It seems to be a pure postgres problem.

              1 Reply Last reply
              0
              • C Christian Ehrlicher
                20 Nov 2022, 13:22

                @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.

                S Offline
                S Offline
                skoczian
                wrote on 21 Nov 2022, 15:07 last edited by
                #7

                @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!

                C 1 Reply Last reply 21 Nov 2022, 15:55
                0
                • S skoczian
                  21 Nov 2022, 15:07

                  @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!

                  C Offline
                  C Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 21 Nov 2022, 15:55 last edited by
                  #8

                  @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 workaround

                  But do whatever you like.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  S 1 Reply Last reply 26 Nov 2022, 13:41
                  1
                  • D Offline
                    D Offline
                    drhammer
                    wrote on 21 Nov 2022, 18:53 last edited by
                    #9

                    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.

                    1 Reply Last reply
                    0
                    • C Christian Ehrlicher
                      21 Nov 2022, 15:55

                      @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 workaround

                      But do whatever you like.

                      S Offline
                      S Offline
                      skoczian
                      wrote on 26 Nov 2022, 13:41 last edited by
                      #10

                      @Christian-Ehrlicher said in QPSQL: authentication method 10 not supported:

                      It was meant
                      a) as a test if it helps

                      True, 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.

                      1 Reply Last reply
                      0

                      7/10

                      21 Nov 2022, 15:07

                      • Login

                      • Login or register to search.
                      7 out of 10
                      • First post
                        7/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved