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 driver not loaded
Forum Updated to NodeBB v4.3 + New Features

QPSQL driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
22 Posts 4 Posters 11.8k Views 2 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.
  • I ivanicy
    3 Feb 2022, 15:14

    @mchinand It has been created again this folder when I execute and I don't know why.

    M Offline
    M Offline
    mchinand
    wrote on 3 Feb 2022, 15:19 last edited by
    #7

    Can you post your .pro project file?

    I 1 Reply Last reply 3 Feb 2022, 15:36
    0
    • M mchinand
      3 Feb 2022, 15:19

      Can you post your .pro project file?

      I Offline
      I Offline
      ivanicy
      wrote on 3 Feb 2022, 15:36 last edited by
      #8

      @mchinand In .pro file I only add "QT += sql". But I don't why it can't find the qsqlpsqld.dll file. This dll is in the sqldrivers folder. How can I make the QFactoryLoader look in the correct folder?

      M 1 Reply Last reply 3 Feb 2022, 15:43
      0
      • I ivanicy
        3 Feb 2022, 15:36

        @mchinand In .pro file I only add "QT += sql". But I don't why it can't find the qsqlpsqld.dll file. This dll is in the sqldrivers folder. How can I make the QFactoryLoader look in the correct folder?

        M Offline
        M Offline
        mchinand
        wrote on 3 Feb 2022, 15:43 last edited by
        #9

        Is there an install or post-build step in your project file?

        I 1 Reply Last reply 3 Feb 2022, 15:58
        0
        • M mchinand
          3 Feb 2022, 15:43

          Is there an install or post-build step in your project file?

          I Offline
          I Offline
          ivanicy
          wrote on 3 Feb 2022, 15:58 last edited by
          #10
          This post is deleted!
          1 Reply Last reply
          0
          • M Offline
            M Offline
            mchinand
            wrote on 3 Feb 2022, 16:11 last edited by
            #11

            Do you have the postgres Qt plugin in one of the many directories you are copying?

            I 1 Reply Last reply 3 Feb 2022, 16:16
            0
            • M mchinand
              3 Feb 2022, 16:11

              Do you have the postgres Qt plugin in one of the many directories you are copying?

              I Offline
              I Offline
              ivanicy
              wrote on 3 Feb 2022, 16:16 last edited by
              #12

              @mchinand I have another clue. I have tried to execute the application from the application folder (out of Qt) and it works...

              M 1 Reply Last reply 3 Feb 2022, 18:19
              0
              • I ivanicy
                3 Feb 2022, 16:16

                @mchinand I have another clue. I have tried to execute the application from the application folder (out of Qt) and it works...

                M Offline
                M Offline
                mchinand
                wrote on 3 Feb 2022, 18:19 last edited by
                #13

                When you say 'out of Qt' do you mean not from QtCreator?

                I 1 Reply Last reply 4 Feb 2022, 07:45
                0
                • M mchinand
                  3 Feb 2022, 18:19

                  When you say 'out of Qt' do you mean not from QtCreator?

                  I Offline
                  I Offline
                  ivanicy
                  wrote on 4 Feb 2022, 07:45 last edited by
                  #14

                  @mchinand Yeah, I mean, opening the .exe directly

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 4 Feb 2022, 08:26 last edited by
                    #15

                    Hi,

                    Did you build the plugin both for debug and release ?

                    Note that the length of your application output with regard to the QPSQL driver messages indicates that you likely did not properly set the QT_DEBUG_PLUGINS environment in Qt Creator. It should be done in the Run part of the Project panel.

                    You should be swamped with plugin related messages and have something more informative with regard to what happens when the plugin loading fails.

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

                    I 1 Reply Last reply 4 Feb 2022, 08:37
                    0
                    • S SGaist
                      4 Feb 2022, 08:26

                      Hi,

                      Did you build the plugin both for debug and release ?

                      Note that the length of your application output with regard to the QPSQL driver messages indicates that you likely did not properly set the QT_DEBUG_PLUGINS environment in Qt Creator. It should be done in the Run part of the Project panel.

                      You should be swamped with plugin related messages and have something more informative with regard to what happens when the plugin loading fails.

                      I Offline
                      I Offline
                      ivanicy
                      wrote on 4 Feb 2022, 08:37 last edited by ivanicy 2 Apr 2022, 08:40
                      #16

                      @SGaist I have this:

                      Got keys from plugin meta data ("QPSQL7", "QPSQL")
                      Cannot load library C:\Users\Ivan\Desktop\Proyectos\sw_RedLook_Fix\build-sw_RedLook_Fix-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug\debug\sqldrivers\qsqlpsqld.dll: No se puede encontrar el módulo especificado.
                      QLibraryPrivate::loadPlugin failed on "C:/Users/Ivan/Desktop/Proyectos/sw_RedLook_Fix/build-sw_RedLook_Fix-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/sqldrivers/qsqlpsqld.dll" : "Cannot load library C:\\Users\\Ivan\\Desktop\\Proyectos\\sw_RedLook_Fix\\build-sw_RedLook_Fix-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug\\debug\\sqldrivers\\qsqlpsqld.dll: No se puede encontrar el módulo especificado."
                      QSqlDatabase: QPSQL driver not loaded
                      QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
                      Error al abrir:  "Driver not loaded Driver not loaded"
                      ERROR:  "Driver not loaded Driver not loaded"
                      

                      I have two doubts here:

                      1. ¿Why it couldn't find qsqlpsqld.dll file if the path is correct. I have this dll in sqldrivers folder.

                      7ed96fa7-fb01-4f97-b1d5-baabf52e0f6f-image.png

                      1. Why Qt creates this folder there if in my example application it doesn't create anything (and it works correctly)
                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 4 Feb 2022, 08:46 last edited by
                        #17

                        One thing I did not realise directly is that it tries to load them from your application folder.
                        How did the plugins go there ?
                        Did you run windeployqt at some point in that folder ?

                        Did you build the plugins yourself ?

                        Do you have the PostreSQL .dll contains folder in your PATH environment variable ?

                        One important thing: all the manipulations of the environment variables should be done within Qt Creator and not at your machine level.

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

                        I 1 Reply Last reply 4 Feb 2022, 08:54
                        0
                        • S SGaist
                          4 Feb 2022, 08:46

                          One thing I did not realise directly is that it tries to load them from your application folder.
                          How did the plugins go there ?
                          Did you run windeployqt at some point in that folder ?

                          Did you build the plugins yourself ?

                          Do you have the PostreSQL .dll contains folder in your PATH environment variable ?

                          One important thing: all the manipulations of the environment variables should be done within Qt Creator and not at your machine level.

                          I Offline
                          I Offline
                          ivanicy
                          wrote on 4 Feb 2022, 08:54 last edited by ivanicy 2 Apr 2022, 08:57
                          #18

                          @SGaist I have this in .pro. But I have it before add QT += sql:

                              isEmpty(TARGET_EXT) {
                                  TARGET_CUSTOM_EXT = .exe
                              } else {
                                  TARGET_CUSTOM_EXT = $${TARGET_EXT}
                              }
                          
                              DEPLOY_COMMAND = windeployqt
                          
                              CONFIG( debug, debug|release ) {
                                  # debug
                                  DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
                              } else {
                                  # release
                                  DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
                              }
                          
                              #Uncomment the following line to help debug the deploy command when running qmake
                              #warning($${DEPLOY_COMMAND} $${DEPLOY_TARGET})
                          
                              QMAKE_POST_LINK = $${DEPLOY_COMMAND} $${DEPLOY_TARGET}
                          

                          I do the same thing in both applications, I only add QT += sql

                          I 1 Reply Last reply 4 Feb 2022, 09:27
                          0
                          • I ivanicy
                            4 Feb 2022, 08:54

                            @SGaist I have this in .pro. But I have it before add QT += sql:

                                isEmpty(TARGET_EXT) {
                                    TARGET_CUSTOM_EXT = .exe
                                } else {
                                    TARGET_CUSTOM_EXT = $${TARGET_EXT}
                                }
                            
                                DEPLOY_COMMAND = windeployqt
                            
                                CONFIG( debug, debug|release ) {
                                    # debug
                                    DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
                                } else {
                                    # release
                                    DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
                                }
                            
                                #Uncomment the following line to help debug the deploy command when running qmake
                                #warning($${DEPLOY_COMMAND} $${DEPLOY_TARGET})
                            
                                QMAKE_POST_LINK = $${DEPLOY_COMMAND} $${DEPLOY_TARGET}
                            

                            I do the same thing in both applications, I only add QT += sql

                            I Offline
                            I Offline
                            ivanicy
                            wrote on 4 Feb 2022, 09:27 last edited by
                            #19

                            @ivanicy When I open the .exe in the application folder, if the sqldrivers folder exists and has the dll, the application works fine, but I don't know why doesn't work when I execute from Qt.

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 4 Feb 2022, 20:54 last edited by
                              #20

                              Nuke your build folder and remove the windeployqt call. Do you still have the problem ?

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

                              I 1 Reply Last reply 7 Feb 2022, 07:59
                              0
                              • S SGaist
                                4 Feb 2022, 20:54

                                Nuke your build folder and remove the windeployqt call. Do you still have the problem ?

                                I Offline
                                I Offline
                                ivanicy
                                wrote on 7 Feb 2022, 07:59 last edited by ivanicy 2 Jul 2022, 08:00
                                #21

                                @SGaist I have the same problem. I have removed the execution folder and comment the QMAKE_POST_LINK line, but it doesn't work. I'm a little desperate, but I am very grateful for your time.

                                I 1 Reply Last reply 7 Feb 2022, 08:55
                                0
                                • I ivanicy
                                  7 Feb 2022, 07:59

                                  @SGaist I have the same problem. I have removed the execution folder and comment the QMAKE_POST_LINK line, but it doesn't work. I'm a little desperate, but I am very grateful for your time.

                                  I Offline
                                  I Offline
                                  ivanicy
                                  wrote on 7 Feb 2022, 08:55 last edited by ivanicy 2 Jul 2022, 08:59
                                  #22

                                  @ivanicy Well, I have solved the problem. I have copied this dlls from PostgreSQL to the .exe folder:

                                  libiconv-2.dll
                                  libintl-8.dll
                                  libpq.dll

                                  and... it works!!

                                  Maybe the problem was that I created this app before I installed the PostgreSQL and the app doesn't integrate the postgre dlls or something like that.

                                  In any case, copying this dlls solves the problem. Thank you very much guys for your help!!

                                  1 Reply Last reply
                                  2

                                  16/22

                                  4 Feb 2022, 08:37

                                  • Login

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