QSQLITE driver not loaded
-
I am making an application in VS 2008 using Qt plugin.
I am able to run the app successfully in VS . But after making package I am getting QSQLITE error. I have added qsqlite.dll with the package also.
But I am not able to run the app. Due to database error. How to solve that??Edit: Moved to Installation & Deployment, as that seems to be the main issue; Andre
-
Where did you put that .dll file?
-
I have used the code
@
QStringList str;
str <<".";
a.setLibraryPaths(str);
a.addLibraryPath("./Debug/plugins/");
qDebug()<<"my library path : "<<a.libraryPaths();
@SO I have created a Debug/plugins/ path & inserted all the files. BUt It did not work.
Does this problem is related to static or shared libraries ??
[EDIT: code formatting, please wrap in @-tags, Volker]
-
Does it work if you create a directory called "sqldrivers" in the directory where you have your executable, and put the .dll file in that directory?
-
Yes I have tried all shots of procedures I can do : tried adding the drivers all where but still not working.
-
Relative paths are evil - you never know what the working directory is. Use
@
a.addLibraryPath(QCoreApplication::applicationDirPath() + "/Debug/plugins/")
@And make sure the driver is in ./Debug/plugins/sqldrivers
-
I found it more reliable to simply add the C source file of SQLITE to my projects. No more deployment hazzle, no more dll hell, no more precedence trouble if a second sqlite.dll is on the target system. SQLITE offers the amalgam file = one file which contains the complete database source. Try to use this.
-
If you build the plugin against the builtin version of SQLite it uses the amalgam version. There is no need to distribute sqlite.dll, but you do need to distribute libqsqlite.dll!
-
Thanks @Volker it solved my problem