I am using VS2008 & QT plugin to make my application. After making package when I am running the application I am getting error :
QSqlDatabase: QSQLITE d
The drivers need to be placed under "sqldrivers", not in the same directory as the executable (they are loaded on runtime, and Qt looks for them in "sqldrivers"). A typical structure of one of our installed applications is like this:
.:
total 26616
-rwxr-xr-x 1 root root 2245632 Sep 29 03:53 AlvaEditor.exe
-rwxr-xr-x 1 root root 2335232 Sep 29 03:53 QtCore4.dll
-rwxr-xr-x 1 root root 8421376 Sep 29 03:53 QtGui4.dll
-rwxr-xr-x 1 root root 199168 Sep 29 03:53 QtSql4.dll
-rwxr-xr-x 1 root root 306688 Sep 29 03:53 libctemplate.dll
-rwxr-xr-x 1 root root 26624 Sep 29 03:53 qgif4.dll
-rwxr-xr-x 1 root root 28672 Sep 29 03:53 qico4.dll
-rwxr-xr-x 1 root root 200704 Sep 29 03:53 qjpeg4.dll
-rwxr-xr-x 1 root root 222720 Sep 29 03:53 qmng4.dll
-rwxr-xr-x 1 root root 439808 Sep 29 03:53 qsqlite4.dll
-rwxr-xr-x 1 root root 21504 Sep 29 03:53 qsvg4.dll
-rwxr-xr-x 1 root root 287232 Sep 29 03:53 qtiff4.dll
drwxr-xr-x 2 root root 4096 Sep 29 03:53 sqldrivers
./sqldrivers:
total 432
-rwxr-xr-x 1 root root 439808 Sep 29 03:53 qsqlite4.dll
Well, the function: addDatabase("QSQLITE"); takes two parameters, the first is the driver and the second is the name of your connection, (passed as a QString)
Now, try the following:
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "SQLITE");
It worked for me, so I guess it'll work for you. (Assuming SQLITE is among your installed drivers)
You can check for SQLITE by the following:
qDebug() << QSqlDatabase::drivers();
Good luck!
Zaher J.G.
Just Add dll file which have folder life platform and drivesr
so simply build app using windeployqt tool
Try this first:
qDebug() << QSqlDatabase::drivers();
to check available Drivers.
Linux platform:
Build your Qt Source with the BR2_PACKAGE_QT5BASE_SQLITE_QT=y
option enabled in .config
file, and copy sqldrivers generated in output path lib/qt/plugins/sqldrivers/libqsqlite.so
to /usr/lib/qt/plugins/sqldrivers/ on Target board and run your application.
Also you can Check where and all your binary/application looks for libraries and plugins using "QApplication::libraryPaths()" API