No SQL driver available
-
Hi,
I try to use SQLITE in my project.
In QMAKE I add:QT += core gui sql opengl
But when I check availabele drivers by typing:
QStringList driverNmaeList = QSqlDatabase::drivers();
I get empty string list. How to add SQLITE? Do I need explicitly add SqLite library to the project?
Windows 10, Qt 5.14.2, MSVC 2017
-
How did you obtain and install Qt? Is this condition on your development box or in a deployed environment?
No, you do not need to explicitly add source files from sqlite to your project. The Qt sqlite plugin has sqlite built in, but this plugin needs to be present. It should be present in the ...\plugins\sqldrivers\ directory or either your development copy of Qt5 or your deployed application's folder structure.
-
@ChrisW67 I just found that Qt can't see SQL drivers only in my current project. In any test project I can see them.
According to this I can supplement the question:
My current project contains two subprojects:app
andcore
.app
depends oncore
.
Both subprojects includeQT += sql
butcore
I compile to the shared library. Socore
doesn't havemain.cpp
and it doesn't haveQApplication a(argc, argv);
. Myapp
subproject hasmain.cpp
andQApplication a(argc, argv);
.
May that be a reason? -
@Please_Help_me_D said in No SQL driver available:
and it worked!
great, so please don't forget to mark you post as solved!