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. Qt 4.8.5 + MySQL + Windows
Forum Updated to NodeBB v4.3 + New Features

Qt 4.8.5 + MySQL + Windows

Scheduled Pinned Locked Moved General and Desktop
12 Posts 4 Posters 5.1k 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.
  • E Offline
    E Offline
    esope
    wrote on last edited by
    #3

    Thanks for the reply,

    I did what you proposed (removed & reinstalled MySQL with 8.3 format name) but I get the same error.

    I look for a post to help me but I found nothing helpful. May be it's my lack of knowledge that prevent me to found something.

    Any suggestion from this...

    If anyone understand the meaning of the previous error message, that will be really appreciated.

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

      Hi, I suggest to follow this tutorial "Qt5 MYSQL Win7":http://seppemagiels.com/blog/create-mysql-driver-qt5-windows

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

        I didn't suggest to install it using 8.3 names, just in a path without spaces. If you wanted to keep your original installation, you would have need to use the 8.3 notations.

        Where do you have your MySQL installed now ?

        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
        • E Offline
          E Offline
          esope
          wrote on last edited by
          #6

          I follow the steps in this tutorial ("Create MySQL driver for Qt on Windows":http://seppemagiels.com/blog/create-mysql-driver-qt-windows) and I adapt some of it for my situation :

          • Qt 4.8.5

          • Microsoft Visual Studio 2010

          • I also installed MySQL 5.5 32bits

          • then I followed this steps : run the following commands from the Qt Command Prompt

          1. set mysql=C:\PROGRA~2\MySQL\MYSQLS~1.5

          2. cd C:\Qt\4.8.5\src\plugins\sqldrivers\mysql

          3. qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro

          4. "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"

          5. qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro "CONFIG+=release"

          6. "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"

          At this point, everything seem to go well. Thanks to you both.

          From now I copy the following to C:\Qt\4.8.5\plugins\sqldrivers

          • qsqlmysql4.dll + qsqlmysql4.lib (from C:\Qt\4.8.5\src\plugins\sqldrivers\mysql\release)

          • qsqlmysqld4.dll + qsqlmysqld4.lib (from C:\Qt\4.8.5\src\plugins\sqldrivers\mysql\debug)

          Also copying

          C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib\libmysql.dll

          to

          C:\Qt\4.8.5\bin

          From this, I was sure it should work!

          But I got a strange behavior, when I run this command :

          QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "my_sql_db");

          I got this output :

          ...

          'Database01.exe' : Chargé 'C:\Qt\4.8.5\plugins\sqldrivers\qsqlmysqld4.dll', Les symboles ont été chargés.

          'Database01.exe' : Déchargé 'C:\Qt\4.8.5\plugins\sqldrivers\qsqlmysqld4.dll'

          QSqlDatabase: QMYSQL driver not loaded

          QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL

          ...

          I'm sorry for the french part again (Chargé mean loaded) and (Déchargé mean unloaded).

          Now, do somebody know why the driver seem to load and unload immediately after?

          Thanks again!

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

            Did you check what lastError() returns ?

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

              I didn't check, thanks.

              The return is

              driverError = "Driver not loaded"
              databaseError = "Driver not loaded"
              errorType = ConnectionError
              errorNumber = -1

              This is interesting, but it doesn't explain why the driver seems to load and right after it is unloaded.

              Thanks for your help...

              1 Reply Last reply
              0
              • E Offline
                E Offline
                Erni35
                wrote on last edited by
                #9

                copy the libmysql.dll to the application directory.

                Erni35

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  esope
                  wrote on last edited by
                  #10

                  Thanks for this input.

                  I copied this DLL everywhere just to be sure (qt/bin, windows/system32, in the application directory, ...)

                  And I obtain the same result... :-(

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

                    Did you copy libmysqld.dll for debug build, too?

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      esope
                      wrote on last edited by
                      #12

                      You found something here. I did not copy the debug DLL. But I can't find it on the MySQL installation.

                      I found the release version on the MySQL/lib folder. And if I compile and run in release, I still got the same problem.

                      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