How to distribute QtSql APP



  • My app work fine on my computer (Debug, release).
    When I copy app files to another computer (All dll file needed) and run app, this Sql error happend: "Driver not loaded"
    -List files are:

    1. QtCore4.dll
    2. QtGui4.dll
    3. QtSql4.dll
    4. SqlIte.dll
    5. SqlIte3.dll
    6. mingwm10.dll
    7. libgcc_s_dw2-1.dll
    8. qsqlite4.dll
      9.myapp.exe
      Help me to resolve this problem
      Thanks you very much!


  • Just guessing here but I assume that the plugins for the different database engines have to be on a special place or that you need on your application to tell the qt "engine" where to search for them. I think in some cases the location of the plugins is actually hard-coded.



  • You also should make directory plugins/drivers/sqldrivers in root of your application directory. Sorry I forgot name of directory, that you need. Then copy database drivers libraries, that you have used.



  • Thanhk you!
    I've done all of above steps, but my app do not run.
    All file that my app needed in the same diretory of myapp.exe.
    I'm newbie with QtSQL, so I don't know how to fix this.
    Help me!


  • Moderators

    In situations like this I recommend to use a tool like procmon (windows) or strace (linux) to watch which files the application opens. That list usually provides some idea about what is missing and where it looks for that stuff.



  • Thanks you very much!
    I've found that:
    I must create a directory named sqldrivers at root of my app directory and copy all Sql dll into it.
    My app work fine.
    thanks you!



  • I don't know SqlIte3.dll and SqlIte3.dll.
    For me application i need only put qsqlite4.dll in sqldrivers.



  • Note that this directory requirement exists for all Qt plugins, not only the sql drivers. It also works for image formats, codecs and other plugins.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.