I think the problem is missing MySQL DLL's. Use DependencyWalker on this "clean" machine and You will see what is missing.
P.S.
I see that in "normal" mode all is working![]()
I think the problem is missing MySQL DLL's. Use DependencyWalker on this "clean" machine and You will see what is missing.
P.S.
I see that in "normal" mode all is working![]()
really thx for reply~
I understand the scenario is qtsql did not find qsqlmysql4.dll plugin.
my confussion is: Why? i've already put this plugin in the same path as execution file. and also in "C:\QT\4.6.2-vc\qt\plugins\sqldrivers" which is same as my developement pc.
Why the plugin would be found if the execution file using qtsql is build as a normal application but not a "qtservice " application?
P.S. the service application is launch by qtservicecontroller or system service control panel (after service installed) but NOT directly execute.
One year later, was any solution found for this problem?
I'm facing the same issue with QtService and QMYSQL. My service only reports to have found these plugins: "QSQLITE, QODBC3, QODBC'", but I need QMYSQL, which is right in my sqlplugins directory.
I have the same problem but on the static version of Qt. If you have the default version of QT you must compile MYSQL driver using the libraryes provided by the mysql site. When you deploy the app you must make another directory where the exe is, named "sqldrivers" and copy qslmysql.dll there.
Here is a link that helped me to build it for the dynamic version of qt.
http://doc.qt.nokia.com/stable/sql-driver.html
That's not exactly the problem here: our programs work flawlessly when executed as standalone applications. I use the default version of Qt, I've compiled the MySQL driver as that website says, and everything runs fine on a regular Qt4 application.
The problem is trying to run a QtService with the MySQL plugin, as the service won't find the plugin. A possible solution would be to recompile Qt4 with -qt-sql-driver, but that'd be really time consuming and I was looking for a quicker solution.
Do you deploy the service in Windows or in unix ?
If you manage to compile using -qt-sql-mysql please tell me howIt seems that I cannot manage to compile using nmake...
I'm working on Windows right now, but with mingw, not with msvc. I once managed to compile with -qt-sql-mysql, but I was cross-compiling on Linux for QtEmbedded.
Hm, actually, it works like a charm in release, it only fails on debug, so there must be something fishy with my debug libraries...
Probably you already know that on debug it searches for qsqlmysql4.dll with d in the name: qsqlmysqld4.dll or something.
Indeed, but for some reason it won't find my sqldrivers/qsqlmysqld4.dll, go figure...
Try this, it works for me.
int main(int argc, char *argv[])
{
QString app_path = QFileInfo(QString::fromLocal8Bit(argv[0])).absolutePath();
QCoreApplication::addLibraryPath(app_path);
OpcService service(argc, argv);
return service.exec();
}
And copy qsqlmysql4.dll to "sqldrivers" subdirectory of your .exe file.
Bookmarks