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
    #1

    Hi everybody,

    I'm sorry to post a so simple question but I'm new to MySQL and compiling stuff.

    So I follow "these instructions":https://qt-project.org/doc/qt-4.7/sql-driver.html to build the QMYSQL plugin on Windows.

    I adapt the instruction like this (for my setup) :

    • set QMAKESPEC=C:\Qt\4.8.5\mkspecs\win32-msvc2010
    • cd C:\Qt\4.8.5\src\plugins\sqldrivers\mysql
    • c:/qt/4.8.5/qmake/qmake "INCLUDEPATH+=C:/Program Files/MySQL/MySQL Server 5.6/include" "LIBS+=C:/Program Files/MySQL/MySQL Server 5.6/lib/libmysql.lib" mysql.pro

    until now I have no problem...

    When I call nmake like this :

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

    I got this error message :



    Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
    Copyright (C) Microsoft Corporation. Tous droits réservés.

    "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe" -f Makefile.Release

    Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
    Copyright (C) Microsoft Corporation. Tous droits réservés.

    C:\iwmake\build_vs2010_opensource_________________PADDING_________________\bin\moc.exe -DUNICODE -DWIN32
    -DQT_NO_CAST_TO_ASCII
    -DQT_NO_CAST_FROM_ASCII
    -DQT_NO_DEBUG
    -DQT_PLUGIN
    -DQT_SQL_LIB
    -DQT_CORE_LIB
    -DQT_THREAD_SUPPORT
    -DQT_NO_DYNAMIC_CAST
    -DNDEBUG
    -I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include\QtCore"
    -I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include\QtSql"
    -I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include"
    -I"c:\Program"
    -I"Files\MySQL\MySQL"
    -I"Server"
    -I"5.6\include"
    -I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include\ActiveQt"
    -I"release"
    -I"........\mkspecs\win32-msvc2010"
    -D_MSC_VER=1600
    -DWIN32 ......\sql\drivers\mysql\qsql_mysql.cpp -o release\qsql_mysql.moc
    The system cannot find the path specified.
    NMAKE : fatal error U1077: 'C:\iwmake\build_vs2010_opensource_________________PADDING_________________\bin\moc.exe' : code retour '0x1'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"' : code retour '0x2'
    Stop.



    I'm sorry for some part of the message in french.

    In fact, I do not understand what is all the "c:\iwmake\build_vs2010_opensource_________________PADDING_________ ..."
    I have no folder named c:\iwmake

    It's my first time using qmake & nmake.

    I will appreciate any inputs. Thanks in advance!

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

      Hi and welcome to devnet,

      First thing to do install reinstall MySQL in a path without space or use the old 8.3 format to give the library path then try again.

      You can also find numerous posts about this subject that might help you on this forum

      Hope it helps

      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
        #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