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. [solved]Qt 5.2 with MySQL- driver not loaded
QtWS25 Last Chance

[solved]Qt 5.2 with MySQL- driver not loaded

Scheduled Pinned Locked Moved General and Desktop
19 Posts 4 Posters 9.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.
  • M Offline
    M Offline
    Muhammad
    wrote on last edited by
    #1

    Hello there,
    I've downloaded and installed Qt 5.2 32 bit for android, my machine is windows 8 64bit, I also have visual studio 2012 installed, MySQL 5.6.16 32bit is installed.

    I'm trying to connect to a MySQL database, but I always get this error

    QSqlDatabse: QMYSQL driver not loaded
    QSqlDatabse: available drivers: QSQLIT QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

    Here is my code
    @
    #include <QCoreApplication>
    #include <QtSql>
    #include <QtDebug>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    return a.exec();
    }
    @

    I've known that in Qt 5.2 there is no need to build the driver, anyway I'v tried and built it but with no difference, I don't know if the built process went well or no.
    Any suggestions please because I spent the last two days searching the net for a solution.
    Thanks.

    I don't have endpoint, I just have Checkpoints.

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

      Hi,

      Do you have the path to your MySQL dlls in your PATH environment variable ? Also check that it's the case in the run panel 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
      • M Offline
        M Offline
        Muhammad
        wrote on last edited by
        #3

        I added both these paths to my PATH environment
        C:\Program Files\MySQL\MySQL Server 5.6\lib
        C:\Program Files\MySQL\MySQL Server 5.6\include

        But I don't know what you mean by checking the case in the run panel in Qt creator. sorry

        I don't have endpoint, I just have Checkpoints.

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

          Qt Creator -> Projects
          Look at your kit, there's a build - run switch, check run and verify that the PATH in "Run environment" also contains the path to the dlls. You don't need to the the include path in PATH.

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

            I've added this path
            C:\Program Files\MySQL\MySQL Server 5.6\lib
            to the path in creator - run, then clean and rebuild and the error is still here

            I don't have endpoint, I just have Checkpoints.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Muhammad
              wrote on last edited by
              #6

              Should I have any dlls in this path
              C:\Qt\Qt5.2.0\5.2.0\Src\qtbase\src\plugins\sqldrivers\mysql

              or any other path regarding mysql or plugins ?

              I don't have endpoint, I just have Checkpoints.

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

                Not in the sources no, only in the binary tree

                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
                • M Offline
                  M Offline
                  Muhammad
                  wrote on last edited by
                  #8

                  what do you mean by binary tree ? Sorry excuse my Ignorant

                  I don't have endpoint, I just have Checkpoints.

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

                    The folder where the dlls and executable can be found.

                    Something like
                    @C:\Qt\Qt5.2.0\5.2.0\msvc_2012@

                    I'm not sure for the exact name

                    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
                    • M Offline
                      M Offline
                      Muhammad
                      wrote on last edited by
                      #10

                      I have the qsqlmysqld.dll and qsqlmysql.dll in this path
                      C:\Qt\Qt5.2.0\5.2.0\mingw48_32\plugins\sqldrivers
                      Is that means that I don't have to build the driver?

                      I don't have endpoint, I just have Checkpoints.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Muhammad
                        wrote on last edited by
                        #11

                        I found the file qsqlmysql.dll in this path C:\Qt\Qt5.2.0\5.2.0\mingw48_32\plugins\sqldrivers and I run dependacy walker on it and here is a photo of what I got
                        !http://imageshack.com/a/img197/4814/ek87.JPG(There should be a photo here )!

                        any tips?

                        I don't have endpoint, I just have Checkpoints.

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          clochydd
                          wrote on last edited by
                          #12

                          I had similar problems with the postgresql driver when installing on a second Win7 machine. After making sure, that the database drivers were in the path ...mingw..plugins\sqldrivers and ...postgresql\lib and bin I still saw the simillar message (missing driver although in list) and I had to completely build new - now it works!
                          Perhaps you may delete the build-directories and build debug or release new.

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

                            If I see thing correctly, you have a 64bit MySQL installed and the MinGW Qt package is 32bit

                            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
                            • M Offline
                              M Offline
                              Muhammad
                              wrote on last edited by
                              #14

                              @clochydd You mean delete the build-directory of the plugin or what, because I re-installed Qt and didn't build the plugin again, as it isn't required in Qt 5.2

                              I don't have endpoint, I just have Checkpoints.

                              1 Reply Last reply
                              0
                              • C Offline
                                C Offline
                                clochydd
                                wrote on last edited by
                                #15

                                Hi Baso, I mean: delete the build directory of your application (ie ...myapp\Debug or ...myapp\Release). The location of your plugins is correct - for testing you may also copy the directory sqldrivers from C:\Qt\Qt5.2.0\5.2.0\mingw48_32\plugins\ to the application build directory ...myapp\Debug\sqldrivers.

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  Muhammad
                                  wrote on last edited by
                                  #16

                                  <SOLVED>
                                  @SGaist You are right (How embarrassing :) ) the tick was that I downloaded the offline MySQL installer for windows(x86-32bit) the installer is 32bit, but the server combined with it was (5.6 64bit) looks like there is no 5.6 server 32bit so I installed the 5.5 32bit server instead and it worked.

                                  Thank you all for your help.

                                  I don't have endpoint, I just have Checkpoints.

                                  1 Reply Last reply
                                  0
                                  • G Offline
                                    G Offline
                                    GolddaineM
                                    wrote on last edited by
                                    #17

                                    How do you deal with numbers? Not everyone is good at math. Many of us were vexed by the complexity of those essential abstractions since school days. And still, as adults we need to build certain math skills to be able to make good financial decisions. We need to know the difference between simple and compound interest, and how to calculate each. And for those seeking to invest, the same can be said of dividends. Below are some basic steps to navigate through the labyrinth of figures. We humbly offer this information in a desire to help the mathematically impaired. How many times have you expected more details on how to apply for a payday loan and resorted to an internet search on quick cash advance?" Your search is over, all of the info you'll need is at "www.MatchFinancial.com.":http://www.matchfinancial.com/

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

                                      You're welcome !

                                      Now that you have it up and running, please update the thread title prepending [solved] so other forum users may know a solution has been 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
                                      • M Offline
                                        M Offline
                                        Muhammad
                                        wrote on last edited by
                                        #19

                                        @SGalst Done :)

                                        I don't have endpoint, I just have Checkpoints.

                                        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