Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QPSL driver is not loaded Win10 MSVC 2015 x64
Forum Updated to NodeBB v4.3 + New Features

QPSL driver is not loaded Win10 MSVC 2015 x64

Scheduled Pinned Locked Moved Solved Installation and Deployment
11 Posts 2 Posters 4.1k Views 1 Watching
  • 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.
  • koronaboraK Offline
    koronaboraK Offline
    koronabora
    wrote on last edited by
    #1

    Hello! I need some help with the most popular question at this section: QPSQL driver is not loaded error.

    OS: Windows 10 x64
    MSVC 2015 x64
    PostgreSQL: 9.5.2 x64
    Qt sql driver: from official installer msvc2015_x64
    

    Dependencies of all libraries checked:
    qt plugin:
    https://yadi.sk/i/J8ybogz1qsamK
    warngings:
    https://yadi.sk/i/W8giYWPiqsapa
    psql:
    https://yadi.sk/i/PON_W6YrqsawK
    warngings:
    https://yadi.sk/i/vx_fjPM-qsazs

    Some code:

    bool SQLContorller::_init()
    {
    	_sqlBase = new QSqlDatabase();
    	_sqlBase->addDatabase(_SQL_DRIVER); //"QPSQL"
    	_sqlBase->setHostName(_host);
    	_sqlBase->setPort(_port);
    	_sqlBase->setDatabaseName(_baseName);
    	_sqlBase->setUserName(_name);
    	_sqlBase->setPassword(_pass);
    	return _sqlBase->open();
    }
    
    

    Debug information from QT:

    QFactoryLoader::QFactoryLoader() looking at "C:/Users/KOT/Documents/Visual Studio 2015/Projects/MoneyManagement/x64/Debug/sqldrivers/qsqlpsqld.dll"
    Found metadata in lib C:/Users/KOT/Documents/Visual Studio 2015/Projects/MoneyManagement/x64/Debug/sqldrivers/qsqlpsqld.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QPSQL7",
                "QPSQL"
            ]
        },
        "className": "QPSQLDriverPlugin",
        "debug": true,
        "version": 329216
    }
    
    
    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    "15:00:33 : Starting user manager"
    loaded library "C:/Users/KOT/Documents/Visual Studio 2015/Projects/MoneyManagement/x64/Debug/sqldrivers/qsqlpsqld.dll"
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\NapiNSP.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\pnrpnsp.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\nlaapi.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Users\KOT\Documents\Visual Studio 2015\Projects\MoneyManagement\x64\Debug\sqldrivers\qsqlpsqld.dll'. Cannot find or open the PDB file.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Users\KOT\Documents\Visual Studio 2015\Projects\MoneyManagement\x64\Debug\libpq.dll'. Cannot find or open the PDB file.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\Wldap32.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Users\KOT\Documents\Visual Studio 2015\Projects\MoneyManagement\x64\Debug\ssleay32.dll'. Cannot find or open the PDB file.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Users\KOT\Documents\Visual Studio 2015\Projects\MoneyManagement\x64\Debug\libintl-8.dll'. Module was built without symbols.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Users\KOT\Documents\Visual Studio 2015\Projects\MoneyManagement\x64\Debug\libeay32.dll'. Cannot find or open the PDB file.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\secur32.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\msvcr120.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Users\KOT\Documents\Visual Studio 2015\Projects\MoneyManagement\x64\Debug\libiconv-2.dll'. Module was built without symbols.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\sspicli.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\mswsock.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\winrnr.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\wshbth.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\DataExchange.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\d3d11.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\dcomp.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\dxgi.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\twinapi.appcore.dll'. Symbols loaded.
    'MoneyManagement.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. Symbols loaded.
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/KOT/Documents/Visual Studio 2015/Projects/MoneyManagement/x64/Debug/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/KOT/Documents/Visual Studio 2015/Projects/MoneyManagement/x64/Debug/accessiblebridge" ...
    "15:00:34 : C:/Users/KOT/Documents/Visual Studio 2015/Projects/MoneyManagement/x64/Debug"
    "15:00:34 : Error while connecting to database!"
    "15:00:34 : Driver not loaded Driver not loaded"
    

    Thank you for help!

    1 Reply Last reply
    0
    • koronaboraK Offline
      koronaboraK Offline
      koronabora
      wrote on last edited by
      #2

      I builded psql plugin using msvc compiler with postgres 9.5.2. Nothing changed.

      Please, could anybody say how to debug this situation: why plugin is not loading? There are no logs about this.

      Thank you!

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Do you also have the folder where the PostgreSQL dlls are in your PATH environment variable ? If not, then simply got to the run part of the Project panel and add it there.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        koronaboraK 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Do you also have the folder where the PostgreSQL dlls are in your PATH environment variable ? If not, then simply got to the run part of the Project panel and add it there.

          koronaboraK Offline
          koronaboraK Offline
          koronabora
          wrote on last edited by koronabora
          #4

          @SGaist
          Yes, global %PATH% includes paths to PostgreSQL's dlls:
          https://yadi.sk/i/DP7N4Xx8qvCSB

          And these dll is in a root near a project binaries:

          ssleay32.dll, iconv.dll, libeay32.dll, libiconv-2.dll, libintl-8.dll, libpq.dll, libxml2.dll, libxslt.dll, zlib1.dll

          P.S.

          I'm modified psql driver code by appending some output to console, but nothing appears at console after driver loading:

          QSqlDriver* QPSQLDriverPlugin::create(const QString &name)
          {
              if (name == QLatin1String("QPSQL") || name == QLatin1String("QPSQL7")) {
                  QPSQLDriver* driver = new QPSQLDriver();
                  std::cout << "Driver loaded by main";
                  return driver;
              }
              std::cout << "Driver not loaded by main";
              return 0;
          }
          
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            After re-reading your plugin loading output, there something strange, did you copy the plugin in your application after building it ?

            It should rather go in Qt's plugins SQL sub folder

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • koronaboraK Offline
              koronaboraK Offline
              koronabora
              wrote on last edited by
              #6

              I'm sorry.

              Using command line to start application:

              @echo off
              MoneyManagement.exe > out.txt
              

              I see this in file "out.txt":

              Driver loaded by main
              

              In lastSqlError variable the same:

              Driver not loaded Driver not loaded
              

              And there are no error messages in MSVC output.

              What I have to do?

              P.S.

              After appending debug output to all methods inside "qsql_psql_p.h" I saw this:

              Plugin consructor called.
              private sql driver constructor called
              QPSQLDriver constructor 1
              Driver loaded by mainQPSQLDriver close
              QPSQLDriver isOpen
              QPSQLDriver destructor
              
              
              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                After re-reading your code sample I just realized: you're using QSqlDatabase wrongly. You are currently trying to open an invalid database object.

                addDatabase is a static function. See the detailed description of QSqlDatabase to see how it's done

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                koronaboraK 1 Reply Last reply
                1
                • SGaistS SGaist

                  After re-reading your code sample I just realized: you're using QSqlDatabase wrongly. You are currently trying to open an invalid database object.

                  addDatabase is a static function. See the detailed description of QSqlDatabase to see how it's done

                  koronaboraK Offline
                  koronaboraK Offline
                  koronabora
                  wrote on last edited by
                  #8

                  @SGaist

                  Thank you again!

                  _sqlBase = new QSqlDatabase();
                  	*_sqlBase = QSqlDatabase::addDatabase(_SQL_DRIVER); //"QPSQL"
                  

                  Now all is ok.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    That's wrong, don't allocate _sqlBase on the heap.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    koronaboraK 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      That's wrong, don't allocate _sqlBase on the heap.

                      koronaboraK Offline
                      koronaboraK Offline
                      koronabora
                      wrote on last edited by
                      #10

                      @SGaist

                      Could you explain to me, why?
                      Thank you.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        One of the reason is explained in QSqlDatbase::removeDatabase.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1

                        • Login

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