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. MYSQL connection on deployment machines not work (Windows)
QtWS25 Last Chance

MYSQL connection on deployment machines not work (Windows)

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 4 Posters 1.1k 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.
  • G Offline
    G Offline
    Gulivert
    wrote on last edited by
    #1

    Hello there,

    I'm sure this is a really common question but I'm not able to find any solution of my problem.

    I build an application with MYSQL plugin, for that I had to build qsqlmysql drivers. I did the job for MacOS and Windows X64, without too much trouble.
    Now I deployed my app, on MacOS systems I did not get any trouble, everything is fine, but not on Windows. The connection failed :'(

    So for Windows, in my application folder I have in the root directory the lib libmysql.dll tacking from the mysql installation folder. I also have the folder sqldrivers with inside the lib qsqlmysql.dll.
    Then when I use my release application in my development machine everything fine, If I use my application in a deployment machine, where no mysql installation or qt exist it is not working, error is "Drivers not loaded". I had this message in my development machine before copying libmysql.dll in the root app folder.

    Any help will be help full.

    DEV environment:

    • Windows 10 x64
    • QT 5.12.6
    • MYSQL community server 5.7.28 winx64
    • qsqlmysql.dll compiler with nmake
    • App compiled with MSVC and cmake
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Start your application with the QT_DEBUG_PLUGINS environment variable set to one. You'll have more information about what is failing with the plugin.

      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
      4
      • G Offline
        G Offline
        Gulivert
        wrote on last edited by
        #3

        Hum sorry but I did not get any more information. How should I use it ?

        From my deployment machine I opened a "cmd" and the set QT_DEBUG_PLUGINS=one app.exe
        But the console don't tell me more :(
        I'm running the app in release mod...

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

          Sorry, I was meaning 1 (note that the documentation states a non zero value so what you did should be enough)

          Did you try with the deployment of a debug build ?

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

            Ok I'm stupid sometimes, I configured cmake as win32 gui application with option set(CMAKE_WIN32_EXECUTABLE ON) then no output in console ^^
            So now the debug give me some infowith a bad news....

            QFactoryLoader::QFactoryLoader() 
            looking at"Y:/Project/build-gynemanager-desktop-client-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug/sqldrivers/qsqlmysqld.dll"Found metadata in lib Y:/Project/build-gynemanager-desktop-client-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug/sqldrivers/qsqlmysqld.dll,
            metadata={ 
               "IID":"org.qt-project.Qt.QSqlDriverFactoryInterface",
               "MetaData":{ 
                  "Keys":[ 
                     "QMYSQL3",
                     "QMYSQL"
                  ]
               },
               "archreq":1,
               "className":"QMYSQLDriverPlugin",
               "debug":true,
               "version":330752
            }
            
            ...
            ...
            ...
            Impossible de charger la bibliothÞque Y:\Project\build-gynemanager-desktop-client-Desktop_Qt_5_12_6_MSVC2017_64bit-debug\sqldrivers\qsqlmysqld.dllá:Le module spÚcifiÚ est introuvable
            QLibraryPrivate::loadPlugin failed on"Y:/Project/build-gynemanager-desktop-client-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug/sqldrivers/qsqlmysqld.dll":"Impossible de charger la bibliothÞque Y:\\Project\\build-gynemanager-desktop-client-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug\\sqldrivers\\qsqlmysqld.dllá: Le module spÚcifiÚ est introuvable."QSqlDatabase:QMYSQL driver not loaded    
            

            Failed to load the model sqldrivers\qsqlmysqld module not fount oO.
            But I look at this folder there is the dll:

            \build-gynemanager-desktop-client-Desktop_Qt_5_12_6_MSVC2017_64bit-Debug\sqldrivers                                                                                                                                                                                                                                             26.11.2019  20:55    <DIR>          .
            26.11.2019  20:55    <DIR>          .. 
            08.11.2019  17:37         1 832 056 qsqlited.dll
            26.11.2019  20:29           177 664 qsqlmysqld.dll
            08.11.2019  17:37           216 696 qsqlodbcd.dll
            08.11.2019  17:37           183 928 qsqlpsqld.dll
            4 fichier(s)        2 410 344 octets
            2 Rép(s)  22 987 157 504 octets libres
            
            1 Reply Last reply
            0
            • G Offline
              G Offline
              Gulivert
              wrote on last edited by
              #6

              Ok I can reproduce this in my development machine by removing libmysql.dll or libmysqld.dll (for debug) in the root app directory.
              I get the same error.

              It seems that the deployment machine not look at root folder for libmysql.dll

              jsulmJ 1 Reply Last reply
              0
              • G Gulivert

                Ok I can reproduce this in my development machine by removing libmysql.dll or libmysqld.dll (for debug) in the root app directory.
                I get the same error.

                It seems that the deployment machine not look at root folder for libmysql.dll

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Gulivert I guess you did not deploy the MySQL client library? qsqlmysqld.dll is not enough - it depends on MySQL client library.
                By the way: it looks like you're deploying debug build.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                G 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @Gulivert I guess you did not deploy the MySQL client library? qsqlmysqld.dll is not enough - it depends on MySQL client library.
                  By the way: it looks like you're deploying debug build.

                  G Offline
                  G Offline
                  Gulivert
                  wrote on last edited by Gulivert
                  #8

                  @jsulm yes I also deployed the mysql lib, this one libmysql.dll (or libmysqld.dll for debug deployment). It is why I did not understand what is going one.... It is like this lib is not used in deployed machine. Or may there is another mysql lib necessary ?

                  jsulmJ 1 Reply Last reply
                  0
                  • artwawA Offline
                    artwawA Offline
                    artwaw
                    wrote on last edited by
                    #9

                    From my limited experience: are you sure that lib is x64? x86 will not work with your software compiled x64.
                    There might be also a version mismatch.

                    For more information please re-read.

                    Kind Regards,
                    Artur

                    1 Reply Last reply
                    0
                    • G Gulivert

                      @jsulm yes I also deployed the mysql lib, this one libmysql.dll (or libmysqld.dll for debug deployment). It is why I did not understand what is going one.... It is like this lib is not used in deployed machine. Or may there is another mysql lib necessary ?

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Gulivert I think it should be libmysqlclient.dll, but not sure.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • artwawA Offline
                        artwawA Offline
                        artwaw
                        wrote on last edited by
                        #11

                        @jsulm I just checked, 2ya I wrote small tool reporting to local MySQL instance. It has been compiled with x86 qmake, external library I used was libmysql.dll from a c++ connector package.

                        For more information please re-read.

                        Kind Regards,
                        Artur

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          Gulivert
                          wrote on last edited by Gulivert
                          #12

                          OK, thank's to Dependency Walker, libmysql.dll need two dll in c:\Windows\system32 that I do not have in my deployment machine.

                          • msvcp120.dll
                          • msvcr120.dll

                          I copied this two dll from development machine and this is working. Now I need to find which vc%%%%%.exe package I have to install to get this lib in all machines which will get my Application.

                          Maybe you have some hints to help me.

                          Thank you all for your proposition!

                          EDIT : IF I add these two libraries in the application root folder this is also working.
                          So just have a question, why windeployqt do not copy them in my application folder ? Is it a bad configuration in the development machine with environment variables?
                          I'm noob in Windows development I'm mainly targeting MacOS system usually...

                          artwawA 1 Reply Last reply
                          0
                          • G Gulivert

                            OK, thank's to Dependency Walker, libmysql.dll need two dll in c:\Windows\system32 that I do not have in my deployment machine.

                            • msvcp120.dll
                            • msvcr120.dll

                            I copied this two dll from development machine and this is working. Now I need to find which vc%%%%%.exe package I have to install to get this lib in all machines which will get my Application.

                            Maybe you have some hints to help me.

                            Thank you all for your proposition!

                            EDIT : IF I add these two libraries in the application root folder this is also working.
                            So just have a question, why windeployqt do not copy them in my application folder ? Is it a bad configuration in the development machine with environment variables?
                            I'm noob in Windows development I'm mainly targeting MacOS system usually...

                            artwawA Offline
                            artwawA Offline
                            artwaw
                            wrote on last edited by
                            #13

                            @Gulivert said in MYSQL connection on deployment machines not work (Windows):

                            msvcp120.dll
                            msvcr120.dll

                            My guess would be latest VC++ redis package that corresponds to your MSVC version.

                            For more information please re-read.

                            Kind Regards,
                            Artur

                            1 Reply Last reply
                            0
                            • G Offline
                              G Offline
                              Gulivert
                              wrote on last edited by Gulivert
                              #14

                              Thank you for your reply.

                              Yes I thought the same as you and try to install the last vcredis C++ from my Visutal Studio installation but without any success. It give me msvcp140.dll.
                              Anyway, currently I do not have time to investigate my Windows development machine configuration, there is clearly a problem between QT Creator environment variable used to compile my app and my manual settings when I compile DLL from my terminal. I will investigate that the next year, right now I missed enough time with this trouble of mysql dll to get it work and I have to code to finish the next release of my app which have to be released on December...

                              To fix this problem temporary I copied de missing dll by hand and add them in the MSI package installer to be deployed to the target customer machines in the app root folder. It's not the best solution but it works.

                              1 Reply Last reply
                              1

                              • Login

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