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. [MSVC 2015] QPSQL driver not loaded

[MSVC 2015] QPSQL driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 762 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.
  • BartoszPajB Offline
    BartoszPajB Offline
    BartoszPaj
    wrote on last edited by
    #1

    Hi,
    I'm trying connect my app to Postgres, but all time I get warning; QPSQL Driver not loaded.

    I did:

    • installed Postgres x86,
    • copied:
      libeay32.dll
      libiconv-2.dll
      libintl-8.dll
      libpq.dll
      ssleay32.dll to QtRoot/ver/msvc2015/bin
    • I've got setted up PATH

    and still nothing work.

    Note:
    Qt ver. 5.9.5
    Compiler: MSVC 2015 32 bit
    OS: Windows 7

    1 Reply Last reply
    0
    • BartoszPajB Offline
      BartoszPajB Offline
      BartoszPaj
      wrote on last edited by BartoszPaj
      #4

      @SGaist said in [MSVC 2015] QPSQL driver not loaded:

      Start your application with the QT_DEBUG_PLUGINS environment variable set to one. That should give you some hints about what is happening.

      WARNING: QLibraryPrivate::loadPlugin failed on "C:/Qt/5.9.5/msvc2015/plugins/sqldrivers/qsqlpsqld.dll" : "Cannot load library C:\\Qt\\5.9.5\\msvc2015\\plugins\\sqldrivers\\qsqlpsqld.dll: Unknown error 0x000000c1." <plugin\qlibrary.cpp:609>
      WARNING: QSqlDatabase: QPSQL driver not loaded <kernel\qsqldatabase.cpp:694>
      

      But file qsqlpsqld.dll & qsqlpsqld.pdb exist.

      @mchinand said in [MSVC 2015] QPSQL driver not loaded:

      Instead of copying dlls, have you tried adding your Postgres' bin directory to your path (or add it to the 'run' path for your project in QtCreator? I would avoid copying dlls to the Qt tree and would instead copy them to the location of your project's executable (but prefer modifying the path environment variable unless you're deploying it to a different computer). My installation of Postgres has more dlls in the bin directory than you listed. You could also run the Dependency Walker on your copied libpq.dll to see what it thinks is missing, if anything.

      I tried fix it by https://forum.qt.io/topic/32688/qpsql-driver-not-loaded/4 , but I have to deploy it to different computer.
      Dependecy Walker didn't point anything is missing.

      UPDATE

      When I leave from IDE Windows pointed error with urctbase.dll, so:

      • use cmd for MSVC 2015 windeployqt app.exe --release --pdb
      • copy all dll from Postgres/version/bin into exe file
      • copy ucrtbase.dll from Windows Kits/10/Redist/ucrt/DLLs/ (arm || x64 || x86 ) into exe file.

      Now I can run app from IDE, but when I try run app from cmd I get the same error with urctbase.dll
      I had mistake in parameter. All fixed.

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

        Hi,

        Start your application with the QT_DEBUG_PLUGINS environment variable set to one. That should give you some hints about what is happening.

        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
        2
        • M Offline
          M Offline
          mchinand
          wrote on last edited by
          #3

          Instead of copying dlls, have you tried adding your Postgres' bin directory to your path (or add it to the 'run' path for your project in QtCreator? I would avoid copying dlls to the Qt tree and would instead copy them to the location of your project's executable (but prefer modifying the path environment variable unless you're deploying it to a different computer). My installation of Postgres has more dlls in the bin directory than you listed. You could also run the Dependency Walker on your copied libpq.dll to see what it thinks is missing, if anything.

          1 Reply Last reply
          2
          • BartoszPajB Offline
            BartoszPajB Offline
            BartoszPaj
            wrote on last edited by BartoszPaj
            #4

            @SGaist said in [MSVC 2015] QPSQL driver not loaded:

            Start your application with the QT_DEBUG_PLUGINS environment variable set to one. That should give you some hints about what is happening.

            WARNING: QLibraryPrivate::loadPlugin failed on "C:/Qt/5.9.5/msvc2015/plugins/sqldrivers/qsqlpsqld.dll" : "Cannot load library C:\\Qt\\5.9.5\\msvc2015\\plugins\\sqldrivers\\qsqlpsqld.dll: Unknown error 0x000000c1." <plugin\qlibrary.cpp:609>
            WARNING: QSqlDatabase: QPSQL driver not loaded <kernel\qsqldatabase.cpp:694>
            

            But file qsqlpsqld.dll & qsqlpsqld.pdb exist.

            @mchinand said in [MSVC 2015] QPSQL driver not loaded:

            Instead of copying dlls, have you tried adding your Postgres' bin directory to your path (or add it to the 'run' path for your project in QtCreator? I would avoid copying dlls to the Qt tree and would instead copy them to the location of your project's executable (but prefer modifying the path environment variable unless you're deploying it to a different computer). My installation of Postgres has more dlls in the bin directory than you listed. You could also run the Dependency Walker on your copied libpq.dll to see what it thinks is missing, if anything.

            I tried fix it by https://forum.qt.io/topic/32688/qpsql-driver-not-loaded/4 , but I have to deploy it to different computer.
            Dependecy Walker didn't point anything is missing.

            UPDATE

            When I leave from IDE Windows pointed error with urctbase.dll, so:

            • use cmd for MSVC 2015 windeployqt app.exe --release --pdb
            • copy all dll from Postgres/version/bin into exe file
            • copy ucrtbase.dll from Windows Kits/10/Redist/ucrt/DLLs/ (arm || x64 || x86 ) into exe file.

            Now I can run app from IDE, but when I try run app from cmd I get the same error with urctbase.dll
            I had mistake in parameter. All fixed.

            1 Reply Last reply
            0

            • Login

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