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. QMYSQL , QPSQL , QPSQL7 ! Driver not found
QtWS25 Last Chance

QMYSQL , QPSQL , QPSQL7 ! Driver not found

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 4 Posters 2.7k 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.
  • T Offline
    T Offline
    tmapp
    wrote on 23 Sept 2020, 15:28 last edited by
    #1

    Hi,
    I'm new at using QT with database ; i've been developing using many dev language and this time i wanted to learn QT & C++ in order to start creating embedded soft.
    When i try to load QMYSQL or QPSQL or QPSQL7 does not work.
    My QT Version is 5.15 ; OS: Windows 10 64
    and i tried the solutions provided on the documentation but does not work !!! My App need to be x32 so i'm using Mingw32 and the tool is MinGw81_32 . Any Help Please !?

    J 1 Reply Last reply 23 Sept 2020, 15:32
    0
    • T tmapp
      23 Sept 2020, 15:28

      Hi,
      I'm new at using QT with database ; i've been developing using many dev language and this time i wanted to learn QT & C++ in order to start creating embedded soft.
      When i try to load QMYSQL or QPSQL or QPSQL7 does not work.
      My QT Version is 5.15 ; OS: Windows 10 64
      and i tried the solutions provided on the documentation but does not work !!! My App need to be x32 so i'm using Mingw32 and the tool is MinGw81_32 . Any Help Please !?

      J Offline
      J Offline
      JonB
      wrote on 23 Sept 2020, 15:32 last edited by JonB
      #2

      @tmapp said in QMYSQL , QPSQL , QPSQL7 ! Driver not found:

      When i try to load QMYSQL or QPSQL or QPSQL7 does not work.

      You should copy & paste the error message you receive when you have such a problem.

      In any case, the answer is always the same for this issue: you need to set environment variable named QT_DEBUG_PLUGINS to value 1. If running your program from Command Prompt:

      set QT_DEBUG_PLUGINS=1
      /path/to/your/application.exe
      

      Or if you run your app from Qt Creator it has a "Run Environment" or similar where you can set this variable.

      Your program will then produce lines of diagnostic output indicating where your problem emanates from.

      T 1 Reply Last reply 23 Sept 2020, 15:45
      0
      • J JonB
        23 Sept 2020, 15:32

        @tmapp said in QMYSQL , QPSQL , QPSQL7 ! Driver not found:

        When i try to load QMYSQL or QPSQL or QPSQL7 does not work.

        You should copy & paste the error message you receive when you have such a problem.

        In any case, the answer is always the same for this issue: you need to set environment variable named QT_DEBUG_PLUGINS to value 1. If running your program from Command Prompt:

        set QT_DEBUG_PLUGINS=1
        /path/to/your/application.exe
        

        Or if you run your app from Qt Creator it has a "Run Environment" or similar where you can set this variable.

        Your program will then produce lines of diagnostic output indicating where your problem emanates from.

        T Offline
        T Offline
        tmapp
        wrote on 23 Sept 2020, 15:45 last edited by
        #3

        @JonB
        The Error Message Always say : QSqlDatabase: QPSQL driver not loaded
        QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
        in the moment where : qpsql*.dll exists in sqldrivers folder. I even tried the exemple found in the projects about the SQL database, in the selection there is PSQLITE, QPSQL and QODBC , but when using QPSQL and i give the information about the connection same Error : driver not loaded

        J 1 Reply Last reply 23 Sept 2020, 15:54
        0
        • T tmapp
          23 Sept 2020, 15:45

          @JonB
          The Error Message Always say : QSqlDatabase: QPSQL driver not loaded
          QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
          in the moment where : qpsql*.dll exists in sqldrivers folder. I even tried the exemple found in the projects about the SQL database, in the selection there is PSQLITE, QPSQL and QODBC , but when using QPSQL and i give the information about the connection same Error : driver not loaded

          J Offline
          J Offline
          JonB
          wrote on 23 Sept 2020, 15:54 last edited by
          #4

          @tmapp
          I told you exactly what & why you need to do with the environment variable. Did you act on that?

          T 1 Reply Last reply 23 Sept 2020, 16:09
          0
          • J JonB
            23 Sept 2020, 15:54

            @tmapp
            I told you exactly what & why you need to do with the environment variable. Did you act on that?

            T Offline
            T Offline
            tmapp
            wrote on 23 Sept 2020, 16:09 last edited by
            #5

            @JonB
            Yep I did :
            ------------------------------------ Information -------------
            section .gnu_debuglink not found in C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll.debug
            section .gnu_debuglink not found in C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll.debug
            QSqlDatabase: QPSQL driver not loaded
            QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
            QSqlDatabase: QPSQL driver not loaded
            QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

            AND on the QT SQL Browser : an error occured while opening the connection : Driver not loaded Driver not loaded.

            J 1 Reply Last reply 23 Sept 2020, 16:14
            0
            • T tmapp
              23 Sept 2020, 16:09

              @JonB
              Yep I did :
              ------------------------------------ Information -------------
              section .gnu_debuglink not found in C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll.debug
              section .gnu_debuglink not found in C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll.debug
              QSqlDatabase: QPSQL driver not loaded
              QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
              QSqlDatabase: QPSQL driver not loaded
              QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

              AND on the QT SQL Browser : an error occured while opening the connection : Driver not loaded Driver not loaded.

              J Offline
              J Offline
              JonB
              wrote on 23 Sept 2020, 16:14 last edited by
              #6

              @tmapp
              That is not the output I would expect with QT_DEBUG_PLUGINS=1. I would expect more detail. Can you show me how you set that, as this would not be the first time someone has not succeeded in doing so successfully.

              T 1 Reply Last reply 23 Sept 2020, 16:22
              0
              • J JonB
                23 Sept 2020, 16:14

                @tmapp
                That is not the output I would expect with QT_DEBUG_PLUGINS=1. I would expect more detail. Can you show me how you set that, as this would not be the first time someone has not succeeded in doing so successfully.

                T Offline
                T Offline
                tmapp
                wrote on 23 Sept 2020, 16:22 last edited by
                #7

                @JonB
                in the project setting i added it in the environement build :
                Capture.PNG

                and the last output i'm getting now :
                Cannot load library C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll: The specified module could not be found.
                QLibraryPrivate::loadPlugin failed on "C:/Qt/QT5/5.15.1/mingw81_32/plugins/sqldrivers/qsqlpsql.dll" : "Cannot load library C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll: The specified module could not be found."
                QSqlDatabase: QPSQL driver not loaded
                QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

                J 1 Reply Last reply 23 Sept 2020, 16:24
                0
                • C Offline
                  C Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 23 Sept 2020, 16:24 last edited by
                  #8

                  As always with this topic (the forum search function is a nice tool btw...) make sure the required libraries for the plugin are in the PATH.

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

                  1 Reply Last reply
                  2
                  • T tmapp
                    23 Sept 2020, 16:22

                    @JonB
                    in the project setting i added it in the environement build :
                    Capture.PNG

                    and the last output i'm getting now :
                    Cannot load library C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll: The specified module could not be found.
                    QLibraryPrivate::loadPlugin failed on "C:/Qt/QT5/5.15.1/mingw81_32/plugins/sqldrivers/qsqlpsql.dll" : "Cannot load library C:\Qt\QT5\5.15.1\mingw81_32\plugins\sqldrivers\qsqlpsql.dll: The specified module could not be found."
                    QSqlDatabase: QPSQL driver not loaded
                    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

                    J Offline
                    J Offline
                    JonB
                    wrote on 23 Sept 2020, 16:24 last edited by
                    #9

                    @tmapp
                    So you have only just done that change now? At least it tells us something then: is the qsqlpsql.dll file indeed not in the directory it shows you it is looking for it?

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tmapp
                      wrote on 23 Sept 2020, 16:34 last edited by
                      #10

                      the specified file exist in the path :
                      Capture.PNG

                      J 2 Replies Last reply 23 Sept 2020, 16:41
                      0
                      • T tmapp
                        23 Sept 2020, 16:34

                        the specified file exist in the path :
                        Capture.PNG

                        J Offline
                        J Offline
                        JonB
                        wrote on 23 Sept 2020, 16:41 last edited by JonB
                        #11

                        @tmapp
                        I am not an expert here, but: I believe that if that .DLL file has missing dependencies (other DLLs) which it cannot find or cannot load, the error message you get is that the first one "could not be found", like yours shows. There is some Windows Dependency Walker app you can download which would allow you to see what other DLLs that DLL needs.

                        That's all I know, unless someone else knows better. You might find other references if you Google/search this forum for QPSQL driver not loaded.

                        M 1 Reply Last reply 23 Sept 2020, 16:44
                        1
                        • J JonB
                          23 Sept 2020, 16:41

                          @tmapp
                          I am not an expert here, but: I believe that if that .DLL file has missing dependencies (other DLLs) which it cannot find or cannot load, the error message you get is that the first one "could not be found", like yours shows. There is some Windows Dependency Walker app you can download which would allow you to see what other DLLs that DLL needs.

                          That's all I know, unless someone else knows better. You might find other references if you Google/search this forum for QPSQL driver not loaded.

                          M Offline
                          M Offline
                          mchinand
                          wrote on 23 Sept 2020, 16:44 last edited by
                          #12

                          @JonB Yes, the Postgres client dll (libpq.dll) and its dependencies also need to be in your path. I'm not sure if the libpq.dll and its dependencies that come with Postgres are compatible with minwgw.

                          T 1 Reply Last reply 23 Sept 2020, 16:50
                          1
                          • T tmapp
                            23 Sept 2020, 16:34

                            the specified file exist in the path :
                            Capture.PNG

                            J Offline
                            J Offline
                            JonB
                            wrote on 23 Sept 2020, 16:45 last edited by
                            #13

                            @tmapp
                            See @mchinand's post above, this is just the sort of cause. And I can leave you in his hands :)

                            1 Reply Last reply
                            0
                            • M mchinand
                              23 Sept 2020, 16:44

                              @JonB Yes, the Postgres client dll (libpq.dll) and its dependencies also need to be in your path. I'm not sure if the libpq.dll and its dependencies that come with Postgres are compatible with minwgw.

                              T Offline
                              T Offline
                              tmapp
                              wrote on 23 Sept 2020, 16:50 last edited by
                              #14

                              @mchinand
                              i copied files in the bin path of the mingw folder (libpq.dll and other dll found in a video of postgresql in youtube ) but doesn't work. I started by Mysql and when i saw qpsql*.dll I changed to it but same errors.
                              @JonB first thank you very much for your help and time , second yeah naturally i google it before , this is my first time posting a question in a forum, all times i google, but this one !

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mchinand
                                wrote on 23 Sept 2020, 19:17 last edited by
                                #15

                                libpq.dll is for connecting to a Postgresql database not a Mysql database (not sure why you mentioned MySql in your most recent reply). Also, these dlls will also have to be 32-bit since your application is 32-bit.

                                T 1 Reply Last reply 23 Sept 2020, 19:50
                                0
                                • M mchinand
                                  23 Sept 2020, 19:17

                                  libpq.dll is for connecting to a Postgresql database not a Mysql database (not sure why you mentioned MySql in your most recent reply). Also, these dlls will also have to be 32-bit since your application is 32-bit.

                                  T Offline
                                  T Offline
                                  tmapp
                                  wrote on 23 Sept 2020, 19:50 last edited by
                                  #16

                                  @mchinand the dlls are 32bit, and about Mysql , it's just mentioning that i tried MySQL first and yet the same problem goes for PostgreSQL dunna know why! only QSQLITE WORK !!!

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    mchinand
                                    wrote on 23 Sept 2020, 20:04 last edited by
                                    #17

                                    Where did you get the libpq and related dlls? You should copy them to the same folder as your project's executable (looks like build-sqlbrowser-Desktop_Qt_15_1_MinGW_32_bit-Debug) or add whatever folder they are in to your PATH environment variable (and restart QtCreator aftewards).

                                    T 1 Reply Last reply 23 Sept 2020, 22:59
                                    0
                                    • M mchinand
                                      23 Sept 2020, 20:04

                                      Where did you get the libpq and related dlls? You should copy them to the same folder as your project's executable (looks like build-sqlbrowser-Desktop_Qt_15_1_MinGW_32_bit-Debug) or add whatever folder they are in to your PATH environment variable (and restart QtCreator aftewards).

                                      T Offline
                                      T Offline
                                      tmapp
                                      wrote on 23 Sept 2020, 22:59 last edited by
                                      #18

                                      @mchinand same problem , no result . I even tried to remake the driver yet an error occured when making :

                                      g++: error: unrecognized command line option '-std=c++1z'
                                      g++: error: unrecognized command line option '-Wshift-overflow=2'
                                      g++: error: unrecognized command line option '-Wduplicated-cond'
                                      mingw32-make[2]: *** [Makefile.Release:403: .obj/release/qsql_sqlite.o] Error 1
                                      mingw32-make[2]: Leaving directory 'C:/Qt/QT5/5.15.1/Src/qtbase/src/plugins/sqldrivers/sqlite'
                                      mingw32-make[1]: *** [Makefile:45: release] Error 2
                                      mingw32-make[1]: Leaving directory 'C:/Qt/QT5/5.15.1/Src/qtbase/src/plugins/sqldrivers/sqlite'
                                      mingw32-make: *** [Makefile:50: sub-sqlite-make_first] Error 2
                                      
                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        tmapp
                                        wrote on 24 Sept 2020, 00:33 last edited by
                                        #19

                                        Hi Again , I solved the problem :: i had to remake the driver and after googling and looking in the forum many guys had the same problem with the actual driver and remaking new one. Here is how to do :

                                        • I'm using Postgresql 10.
                                        1. you need to download the zip file of postgresql where source code exist.
                                        2. lunch the Qt Mingw console.
                                        3. copy all the file exists in the include path of the download zip in %Path_TO_QT\src\qtbase\plugins\sqldrivers\psql  
                                          ( if you don't you'll have problems with include files .h in mingw32-make
                                        4. make sur to copy the lib files to the same folder psql ( libpq.dll , libeay32.dll, libintl , libiconv, ssleay32.dll ) ssleay32 you can have i from the net ( i got it from my xampp folder) 
                                        5. edit the file psql.pro and comment : QMAKE_USE += psql  with a #
                                          if you don't you'll have error : psql model not defined
                                        6. run the qmake command as follow: qmake "INCLUDEPATH+=PATH_TO_DOWNLOAD_SOURCE\pgsql\include" "LIBS+=PATH_TO_DOWNLOADED_SOURCE\pgsql\lib" psql.pro
                                          here PATH_TO_DOWNLOAD_SOURCE mean the path to the download zip extracted
                                        7. run mingw32-make
                                        8. run mingw32-make install
                                        

                                        Congrats.
                                        @Christian-Ehrlicher @JonB @mchinand thanks for your time and help :)

                                        1 Reply Last reply
                                        2

                                        2/19

                                        23 Sept 2020, 15:32

                                        topic:navigator.unread, 17
                                        • Login

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