PDA

View Full Version : Sqlite driver not loading



waynew
22nd May 2010, 17:22
Trying to deploy an application on Windows but Sqlite driver is not loading.
After searching the forum, I have it set up as follows:

Executable and other files directory is C:\HRLogger_Release
Drivers qsqlite4.dll and sqlite3.dll are in C:\HRLogger_Release\sqldrivers

Using this code:


QString applPath = QCoreApplication::applicationDirPath();
applPath.append("/sqldrivers");
qApp->addLibraryPath(applPath);
qDebug() << "applPath is now " << applPath;


Produces this:
applPath is now "C:/HRLogger_Release/sqldrivers"
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:

What am I missing here?

Lykurg
22nd May 2010, 21:59
as far as I remember sqlite3.dll has to be in the root directory. Alternatively you can build Qt with on-board-sqlite. Then you wont face such kind of problems.

waynew
22nd May 2010, 22:14
Thanks Lykurg but copying sqlite3.dll to the application root directory had no effect.
I should have explained that the application executable and associated files are being generated on a Windows machine with a default Qt installation that included sqlite. Then the release directory is copied over to the target Windows machine which does not have Qt installed.
The application runs fine on the development machine - from either debug or release build.
Any other ideas?

Lykurg
23rd May 2010, 07:03
Hm which version of Qt are you using? Because 4.6.2 had build in support for sqlite. From where do you get the Qt dll's? make sure you have take them from C:\Qt\2010.02.1\qt\bin.

waynew
23rd May 2010, 13:15
Thanks Lykurg! Upgraded to 4.6.2 and deployed successfully! I can't believe how fast this database application runs on an old Lenovo notebook.
Qt rocks.