[SOLVED] How to install an application using SQlite under Windows?



  • Hello, Everyone,

    I've written an application that is using QNetwork and QSql, especially the SQlite plugin.

    To build the Windows installer I use ClickTeam's Installer Creator. Works fine...!
    I put the following files into the Setup:

    the application's .exe
    the application's icon file
    libgcc_s_dw_2-1.dll
    mingwm10.dll
    QtCore4.dll
    QtGui4.dll
    QtNetwork4.dll
    QtSql4.dll
    qsqlite4.dll

    Installed on a machine that never saw a complete Qt installation, the app starts up, does it's work fine, but opening the database file fails. QSqlDatabase::open() returns 'false'!
    After I read about plugins (like qsqlite4.dll) need to be stored in a subdir named "plugins" I tried this, but the result is the same.

    Did I forget any file for the SQL support?
    Do I need to build a special directory hirarchy?

    Thanks a lot in advance for any hint.

    Kind regards
    Joerg



  • You must put qsqlite4.dll in a subfolder as such: plugins/sqldrivers as explained "here":http://doc.qt.digia.com/latest/plugins-howto.html.



  • Hello, rcari,

    thank you, but that didn't work.

    I put qsqlite4.dll into %ApplicationDirectory%/plugins/sqldrivers.
    All directories have been created in a valid state.

    In case QSqlDatabase::open() returns false I fed a QMessageBox with the output of QSqlDatabase::lastError(). It simply says "Driver not loaded"...

    I can't find the answer to this issue in the article you postet, so I need to ask, if I'd rather put the directory structure of the Qt-Libraries including the plugins/sqldrivers folder into Window's System folder or if there's a system variable to be set to point on the .dll's...?

    Sorry, but I'm a bloody beginner in Qt programming...



  • Actually, you don't need the plugins folder: just put sqlite4.dll in a sqldrivers folder right next to the executable.
    This has to do with the "library paths":http://qt-project.org/doc/qt-4.8/qcoreapplication.html#libraryPaths. My bad!



  • Hello, rcari,

    this works. Thank you so much!!!

    Your hint concerning QCoreApplication::libraryPath() is gold worthy!

    I confess, I often lose awareness on the doc, but this one should solve quite a lot of problems in the future before they arise.

    You made my day!
    Once again: Thank you!

    Regards
    Joerg


Log in to reply
 

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