Important: Please read the Qt Code of Conduct -

[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

    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

  • You must put qsqlite4.dll in a subfolder as such: plugins/sqldrivers as explained "here":

  • 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": 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!


Log in to reply