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

MySQL 5.6 driver available, yet not loaded?

Scheduled Pinned Locked Moved Installation and Deployment
14 Posts 3 Posters 5.6k 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,

    Do you have MySQL installed ? Is the path to the MySQL dlls in your PATH environment variable ?
    You can use Dependency Walker on your qsqlmysql.dll to see whether all dependencies can 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
    • A Offline
      A Offline
      ArisenVendetta
      wrote on last edited by
      #3

      The dependencies that aren't located when using dependency walker on qsqlmysql.dll are:

      • qt5core.dll
      • qt5sql.dll
      • libgcc_s_dw2-1.dll; and
      • libstdc++-6.dll

      To me this seems normal, as they would be loaded into the project with this dll as well so it would be access to them, and would not pose an issue.

      Unless I've completely confused how this works, in which case please fill me in.

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

        So it does find the MySQL dlls ?

        If so, you need to add some debugging statement in your code to see what error does QSqlDatabase return and also double check that PATH in your run table does contain the path to the MySQL dlls

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

          When I run dependency walker on my exe, all dll's required are present. In my PATH var, all required dll's have paths pointing to them. I'm confused and frustrated and have NO clue what to do or how to get it working.

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

            Do you test whether your database opening is successful ? If so do you print a warning with QSqlDatabase::lastError() content ?

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

              Yes I do.

              @
              bool hasMysql = ((db->drivers().indexOf("QMYSQL") > -1) ? true:false);

              if (hasMysql) {
                  new QListWidgetItem(timestamp() + QString("MySQL driver located"), ui->messageWindow);
                  db->addDatabase("QMYSQL");
                  db->setHostName("localhost");
                  db->setDatabaseName("psadatacentral");
                  db->setUserName("guest");
                  db->setPassword("public");
                  if (!db->open())
                      conReply = db->lastError().text();
                  else
                      conReply = tr("Successfully connected to database `") + db->databaseName() + tr("`");
              } else {
                  conReply = tr("MySQL driver unavailable");
              }
              

              @

              And the output of that is

              @
              MySQL driver located
              Driver not loaded Driver not loaded
              @

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

                Maybe a silly question but, did you install a 32bit 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
                • A Offline
                  A Offline
                  ArisenVendetta
                  wrote on last edited by
                  #9

                  I rechecked to make sure and yes. I have 32bit MySQL server 5.6 running, 32bit qt-creator, 32bit drivers (debug and release builds).

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #10

                    Try setting the QT_DEBUG_PLUGINS environment variable to 1 when you run your application. It will give you a lot of debug info that can be useful to debug why plugins don't load.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      ArisenVendetta
                      wrote on last edited by
                      #11

                      I did that aswell and it loads qsqlmysqld.dll if it's a debug build, and loads qsqlmysql.dll if it's a release build.

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

                        Did you check the PATH variable in the Run pane of your project to see whether the path the MySQL was also there ?

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

                          It has the path to mysql utilities. As far as I'm aware, it never had anything other path in it regarding mysql, or to my knowledge needed any other.

                          ALSO: As a note, the guide I followed to make my drivers, when running the qmake, while appending to LIBS

                          @"LIBS+=%mysql%\lib\libmysql.lib"@
                          was used opposed to
                          @"LIBS+=-L%mysql%\lib\libmysql.lib"@
                          because the site I used didn't have it present. When I found out (just recently), I tried to rebuild them, and I get several undefined reference errors ("visible here":http://pastebin.com/9FtYi9dh)

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            ArisenVendetta
                            wrote on last edited by
                            #14

                            I hate to bump this up or anything, and I do appreciate the help. Problem is I'm on a time limit and I really need to solve this issue, so If anyone has anything to contribute, please let me know! I'm still stuck on this, and have been for 2 two weeks.

                            So please, anything will help I'm sure!

                            EDIT: I'd like to note my environment has changed. I have changed from Qt5.1 using MinGW to Qt5.2 for VS2012 32-bit and using VS2012 compiler for 32-bit from VS 2012 Express. I am also using MySQL Server 5.6 32-bit. Qt5.2 comes with precompiled QMYSQL drivers, and even these do not work. So I'm still at a loss.

                            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