Qt & SQLite deploy problems.
-
Well, I would make an guess here: ;-)
Investigate the possibility that the “Driver not loaded Driver not loaded.” and the SEG FAULT are two different problems.
-
[quote author="Stavros" date="1312021044"]Well, I would make an guess here: ;-)
Investigate the possibility that the “Driver not loaded Driver not loaded.” and the SEG FAULT are two different problems. [/quote]
Thanks Stavros, my question obviously wasn't clear.
Could the failure to load the db driver and the subsequent failure of db.open() cause any future calls, such as db.lastError().text(), to result in an access violation?
I realise this is a separate issue though, which I'll handle once I get the library loaded, I was just wondering at the time of writing the post. -
To differentiate library can't available or file error, use this code
@db = QSqlDatabase::addDatabase("QSQLITE");
if (!db.isDriverAvailable("QSQLITE"))
QMessageBox::warning(this,"Error",db.lastError().text());@If no library in path, error will prompt "Driver not loaded ...".
Otherwise, that may be file error.. -
Hi Zither,
I simply get "Driver not loaded." But I know this is the case since if I restore the SDK path it works just fine.
It simply won't run qsqlite4.dll out of ./plugins/sqldrivers/ nor ./sqldrivers/Thanks.
-
Are you sure you copied the correct qsqlite4.dll ?
There is an incompatible one in QtSDK/QtCreator/bin/sqldrivers and if you are compiling in debug mode, you should probably copy qsqlited4.dll instead of qsqlite4.dll in ./sqldrivers directory. -
To get information from Qt about the loading of the plugin, you can use the "QT_DEBUG_PLUGINS ":http://doc.qt.nokia.com/latest/deployment-plugins.html environment variable. This might help you to find the cause of the problem. Set this variable to a non-zero value in the environment from which your application is launched.
-
Hi Guys,
I am still struggling with this problem. Does anyone have any other suggestions?
I have tried multiple systems and different installs of Mingw & Qt with the same result every time.
-
QT 5.3.1
Using qsqliteI had this same problem and solved with a shotgun approach. I knew it was missing the dll, just didn't know where so I put the dll everywhere, presto it works. Then with the application still running I attempted to delete each of the eight qsqlite.dll files. I could delete 7, one of them was locked. Excellent.
So it seems that with a deployed application you want to create a "sqldrivers" folder beside the platforms folder and place your sql dll in there. Here is my layout:
My.exe
Qt5Core.dll
Qt5Sql.dll
+\platforms ( qwindows.dll, qoffscreen.dll, qminimal.dll )
+\sqldrivers ( qsqlite.dll )Cheers All,
Derrek -
Thanks for sharing your solution, Derrek. For future reference, the procedure is documented at http://qt-project.org/wiki/Deploy_an_Application_on_Windows (diagram below).
Note that your program will only use qwindows.dll, so you don't need qofscreen.dll and qminimal.dll.
-
For the record;
This problem was fixed up by eventually grabbing a later release (think I built from source too).