Deploying app with sql plugins
I've built an app that works perfect on my development machine (where I have full QT package installed). I decided to test it on the other machine so I've copied all files (including all required dll) to new machine and run the application.
What does not work is a MySQL driver. Application runs without any problems, but when I try to connect to database it returns an error saying "Driver not loaded". So I've followed some thread on the forum & docs and copied sqldrivers plugin directory, added path to library paths, but it didn't help.
The App is run from C:/slican.
I think that the file which is required is the one from QT Installation path, so in my case it is:
On the test machine this file is now copied into:
I've checked library paths using this code in the main.cpp:
QApplication a(argc, argv);
QString str = a.applicationDirPath() + "/plugins";
QString strl = QString("(%1): %2").arg(a.libraryPaths().count()).arg(a.libraryPaths().join(";"));
The strl variable is passed to MainWindow to display what paths are checked, here is the strl value:
And when I try to connect to DB it still says that driver was not loaded. Test machine is the newly created virtual machine with windows 10 on board. Do I need to copy any dll somewhere to the windows directory or something?
Can anyone help?
Thanks & Regards
"qsqlmysql.dll" depends on "libmysql.dll", which is not distributed with Qt due to licensing issues. Maybe that's what you're missing. You should have it in your exe's directory.
To add to @Leonardo you also have the windeployqt tool that might help you get your dependencies right.