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. MYSQL / QT issues
Forum Updated to NodeBB v4.3 + New Features

MYSQL / QT issues

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
20 Posts 4 Posters 1.5k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    Did you already try to run your application with the QT_DEBUG_PLUGINS environment variable set to 1 ?

    Because from the looks of it, you have the drivers themselves ready to use.

    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
    • J Offline
      J Offline
      Jdonoher
      wrote on last edited by Jdonoher
      #3

      Hi thanks for the response, sorry im a complete qt novice I've seen reference to QT_DEBUG_PLUGINS but I have no idea where this is or how to change it? * edit : I think I have set it: 3a8ae6cc-58dc-46e0-b748-42de913f79a2-image.png however on running I still get just the same error.

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

        The environment variable won't fix your error, it will dump a lot of information about what is going on with your plugins.

        As for editing it, do it in the Run part of the Project panel.

        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
        • J Offline
          J Offline
          Jdonoher
          wrote on last edited by
          #5

          ahhhh got you the follwing was spat out regarding Mysql:
          QFactoryLoader::QFactoryLoader() looking at "C:/Qt/6.2.3/mingw_64/plugins/sqldrivers/qsqlmysql.dll"
          Found metadata in lib C:/Qt/6.2.3/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
          "QMYSQL",
          "className": "QMYSQLDriverPlugin",
          Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
          Cannot load library C:\Qt\6.2.3\mingw_64\plugins\sqldrivers\qsqlmysql.dll: The specified module could not be found.
          QLibraryPrivate::loadPlugin failed on "C:/Qt/6.2.3/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\Qt\6.2.3\mingw_64\plugins\sqldrivers\qsqlmysql.dll: The specified module could not be found."
          QSqlDatabase: QMYSQL driver not loaded
          QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL

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

            Can the connector .dll be found ?

            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
            • J Offline
              J Offline
              Jdonoher
              wrote on last edited by Jdonoher
              #7

              Hi sorry not sure where to see this, there was no mention of connector .dll in the debuf_plugin message, I think I need to follow this step: compiling driver. However I dont have a qt command prompt and am struddling to run through the standard windows cmd line. Aslo in looking at other threads, I do not have a .pro in the mysql folder in ~src/plugins/sqldrivers/mysql could this be the issue?

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

                Based on the output, you already have the .dll.

                As for the MySQL connector .dll, where did you install MySQL ?

                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
                • J Offline
                  J Offline
                  Jdonoher
                  wrote on last edited by Jdonoher
                  #9

                  I downloaded the C connector from here
                  And donwloaded it to C:\Program Files

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

                    Then, do you have that path in your PATH environment variable ? (Still in Qt Creator)

                    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
                    • J Offline
                      J Offline
                      Jdonoher
                      wrote on last edited by
                      #11

                      There isnt one so Im guessing I add PATH as the variable and the value being the dir?

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

                        PATH is already defined, you may have to check a checkbox on the Run panel in order to have access to it.

                        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
                        • J Offline
                          J Offline
                          Jdonoher
                          wrote on last edited by Jdonoher
                          #13

                          Hi, I couldnt find the PATH variable but ran this command in main.cpp:
                          QCoreApplication::addLibraryPath("C:\Program Files\MySQL");
                          However this didnt change any of the logs. Im a bit lost with where to go from here

                          JonBJ 1 Reply Last reply
                          0
                          • J Offline
                            J Offline
                            Jdonoher
                            wrote on last edited by
                            #14

                            @SGaist I have also tried to compile driver using the following in the command prompt :
                            C:\Qt\6.2.3\Src\qtbase\src\plugins\sqldrivers>qmake -version
                            QMake version 3.1
                            Using Qt version 6.2.3 in C:/Qt/6.2.3/mingw_64/lib

                            C:\Qt\6.2.3\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"

                            However it doesnt do anything after the second command, just gives me basic qmkae info.

                            1 Reply Last reply
                            0
                            • J Jdonoher

                              Hi, I couldnt find the PATH variable but ran this command in main.cpp:
                              QCoreApplication::addLibraryPath("C:\Program Files\MySQL");
                              However this didnt change any of the logs. Im a bit lost with where to go from here

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by
                              #15

                              @Jdonoher said in MYSQL / QT issues:

                              QCoreApplication::addLibraryPath("C:\Program Files\MySQL");

                              Did you really copy and paste this line from your C++ source code file? Please copy and paste whatever you have literally, do not type it in by hand.....

                              J 1 Reply Last reply
                              0
                              • JonBJ JonB

                                @Jdonoher said in MYSQL / QT issues:

                                QCoreApplication::addLibraryPath("C:\Program Files\MySQL");

                                Did you really copy and paste this line from your C++ source code file? Please copy and paste whatever you have literally, do not type it in by hand.....

                                J Offline
                                J Offline
                                Jdonoher
                                wrote on last edited by Jdonoher
                                #16

                                @JonB It was copied. 37a99e6e-416e-4722-92af-3a9718434e27-image.png

                                I tired with'\' and '/' just in case but either way didnt help.

                                1 Reply Last reply
                                1
                                • J Offline
                                  J Offline
                                  Jdonoher
                                  wrote on last edited by Jdonoher
                                  #17

                                  I've alslo managed to finally get .pro file in my /mysql dir in src. However it cannot build, I have included the include path from the mysql connector as well as added the lib to LIBS. but am getting 3 errors: a81d5a34-9025-4850-8bb0-0dd7e548667f-image.png

                                  Here is mysql.pro file:
                                  3c368e2b-ab74-4539-b282-3e99497c3245-image.png

                                  JonBJ 1 Reply Last reply
                                  0
                                  • J Jdonoher

                                    I've alslo managed to finally get .pro file in my /mysql dir in src. However it cannot build, I have included the include path from the mysql connector as well as added the lib to LIBS. but am getting 3 errors: a81d5a34-9025-4850-8bb0-0dd7e548667f-image.png

                                    Here is mysql.pro file:
                                    3c368e2b-ab74-4539-b282-3e99497c3245-image.png

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by
                                    #18

                                    @Jdonoher
                                    I could be wrong, but because your paths have spaces in them I would have expected them to need to be quoted, like:

                                    INCLUDEPATH += "C:/Program Files/MySQl/MySQL Connector C 6.1/include"
                                    LIBS += "C:/Program Files/MySQl/MySQL Connector C 6.1/lib"
                                    
                                    J 1 Reply Last reply
                                    1
                                    • JonBJ JonB

                                      @Jdonoher
                                      I could be wrong, but because your paths have spaces in them I would have expected them to need to be quoted, like:

                                      INCLUDEPATH += "C:/Program Files/MySQl/MySQL Connector C 6.1/include"
                                      LIBS += "C:/Program Files/MySQl/MySQL Connector C 6.1/lib"
                                      
                                      J Offline
                                      J Offline
                                      Jdonoher
                                      wrote on last edited by
                                      #19

                                      @JonB yeah Ive tried both ways multiple times and still errors, strangely I get more build errors with quotes than without but quotes certainly feel necessary

                                      1 Reply Last reply
                                      0
                                      • Christian EhrlicherC Offline
                                        Christian EhrlicherC Offline
                                        Christian Ehrlicher
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #20

                                        Simply move it to a folder without spaces...

                                        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
                                        0

                                        • Login

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