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. QtSQL drivers not loaded on client PC
Forum Updated to NodeBB v4.3 + New Features

QtSQL drivers not loaded on client PC

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 6.0k 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.
  • S Offline
    S Offline
    Sibyx
    wrote on last edited by
    #1

    Hi, I created app which using QtSQL plugins (QIBASE, QMYSQL, QMSSQL, QDB2).On my PC all work fine, but I moved to another PC without QtSDK I have output:
    @Driver not loaded Driver not loaded@
    I solved depencies and I copy drivers dll's to subdir plugins:
    C:\myapp
    C:\myapp\plugins
    I use depency walker to get all depencies to database drivers and copy it to plugins dir. I edit my app to read plugins from plugins dir using QCoreApplication::addLibraryPath :
    @int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QCoreApplication::addLibraryPath(a.applicationDirPath() + "/plugins");
    formIndex w;
    w.show();
    return a.exec();
    }@
    I know there is lot of solutions on internet and I try to solve this alone but I can't find good solution for me

    1 Reply Last reply
    0
    • F Offline
      F Offline
      francomartins
      wrote on last edited by
      #2

      all dll's from sql need to be in a folder called "sqldrivers" that would be within the plugins folder of your application

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sibyx
        wrote on last edited by
        #3

        I created dir sqldrivers under plugins:
        C:\myapp
        C:\myapp\plugins\sqldrivers
        I edited my app main file:
        int main(int argc, char *argv[])
        @{
        QApplication a(argc, argv);
        QStringList pathList;
        pathList.append(a.applicationDirPath());
        pathList.append(a.applicationDirPath() + "/plugins");
        QCoreApplication::setLibraryPaths(pathList);
        qDebug() << a.libraryPaths();
        formIndex w;
        w.show();
        return a.exec();
        }@
        Inside plugins/sqldrivers are all sql drivers depencies include QtCore4.dll etc.
        And now I run my app still nothing, what I do wrong?

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

          On deployment computer don't need to create plugins folder. So the folder structure should like:
          app
          app/sqldrivers

          Also for windows application, there is no need to call
          @
          QCoreApplication::setLibraryPaths
          @

          edit: in sqldrivers folder is enough to put only sql plugins (qsqlmysql4.dll, etc ... without Qt dependencies)

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sibyx
            wrote on last edited by
            #5

            And where I can put dll's dependencies? For example I have Interbase/Firebird driver and it has depency gds32.dll

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cincirin
              wrote on last edited by
              #6

              You can put all dependencies anywhere in "KnownDLLs" locations ( see "Dynamic-Link Library Search Order":http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx), or you can put them near your executable

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Sibyx
                wrote on last edited by
                #7

                Thanks! Now it works :)

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  marcogaribay
                  wrote on last edited by
                  #8

                  I made an app that used the db name:
                  @
                  "DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=" + SourceDB + ";"
                  @

                  It rans perfectly on my dev machine but some clients returned "Driver not found" when the process hit this line of code.

                  The fix was to include on client machines the file:
                  @
                  sqldrivers\qsqlodbc4.dll
                  @

                  I.e. if my app was in
                  @
                  c:\myApp\app.exe
                  @

                  ...then the dll was copied to:
                  @
                  c:\myApp\sqldrivers\qsqlodbc4.dll
                  @

                  Note that this fixed the "Driver not found" on the Win32 version of my app, however, the x64 version still fails as there isn't a 64b version of the microsoft ODBC drivers.

                  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