1

I am getting the driver not loaded error when trying to open an sqlite database with Qt 5.15.0 on Windows.
Here is my output: QSqlDatabase: QSQLITE driver not loaded QSqlDatabase: available drivers: QSQLITE QPSQL QPSQL7 QODBC QODBC3 "Driver not loaded Driver not loaded"

Here are the files in the directory with my .exe (currently and for this output): main.o app.exe qrc_qml.cpp qrc_qml.o

I have done some searches on this topic and they have suggested the following:

  1. manually move the sqldrivers folder to the exe directory or try moving its contents to the directory, neither have resolved my issue, output remains the same
  2. use windeployqt. I have tried this but despite it moving the dlls including moving the sqldrivers folder to the exe directory, the same error appears

Please let me know what you suggest

QSqlDatabase my_db = QSqlDatabase::addDatabase("QSQLITE");
my_db.setDatabaseName("test.db");

if(my_db.open())
{
    qDebug() << "open";
}
else
{
    qDebug() << my_db.lastError().text();
}
  • Can you send the directory from where you are copying qsqlite.dll? – Robert.K Jun 22 '20 at 02:53
  • Did you remember to add QT += sql to your .pro file? Do you get the same issue if you use one of the complete sqlite code examples included in Qt docs/examples? – TomasL Jun 25 '20 at 08:48
  • I am facing the same issue under Linux. It should work in theory, but it does not. In my case I did set `QT += sql`. – Philipp Ludwig Dec 03 '21 at 15:29

0 Answers0