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. Deploying app with sql plugins
QtWS25 Last Chance

Deploying app with sql plugins

Scheduled Pinned Locked Moved General and Desktop
deploymentsqldriversmysql
4 Posts 3 Posters 1.8k 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.
  • P Offline
    P Offline
    pkwiecien
    wrote on last edited by
    #1

    Hello
    I've built an app that works perfect on my development machine (where I have full QT package installed). I decided to test it on the other machine so I've copied all files (including all required dll) to new machine and run the application.

    What does not work is a MySQL driver. Application runs without any problems, but when I try to connect to database it returns an error saying "Driver not loaded". So I've followed some thread on the forum & docs and copied sqldrivers plugin directory, added path to library paths, but it didn't help.

    The App is run from C:/slican.

    I think that the file which is required is the one from QT Installation path, so in my case it is:
    C:\Qt\5.4\mingw491_32\plugins\sqldrivers\qsqlmysql.dll

    On the test machine this file is now copied into:
    C:/slican/plugins
    C:/slican/sqldrivers
    C:/slican/plugins/sqldrivers

    I've checked library paths using this code in the main.cpp:
    QApplication a(argc, argv);
    QString str = a.applicationDirPath() + "/plugins";
    a.addLibraryPath(str);
    QString strl = QString("(%1): %2").arg(a.libraryPaths().count()).arg(a.libraryPaths().join(";"));

    The strl variable is passed to MainWindow to display what paths are checked, here is the strl value:
    (2): C:/slican/plugins;C:/slican

    And when I try to connect to DB it still says that driver was not loaded. Test machine is the newly created virtual machine with windows 10 on board. Do I need to copy any dll somewhere to the windows directory or something?
    Can anyone help?

    Thanks & Regards
    Przemek

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      "qsqlmysql.dll" depends on "libmysql.dll", which is not distributed with Qt due to licensing issues. Maybe that's what you're missing. You should have it in your exe's directory.

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

        Hi,

        To add to @Leonardo you also have the windeployqt tool that might help you get your dependencies right.

        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
        • L Leonardo

          "qsqlmysql.dll" depends on "libmysql.dll", which is not distributed with Qt due to licensing issues. Maybe that's what you're missing. You should have it in your exe's directory.

          P Offline
          P Offline
          pkwiecien
          wrote on last edited by
          #4

          @Leonardo Thanks, that helped.
          @SGaist Thanks, I'll check that.

          Regards,
          Przemek

          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