[Solved] QT & MySQL - What must be done? [Beginner]
I want to start accessing a MySQL-DB programatically with Qt.
The basic question is - what do I have to do?
Here is my setup:
Visual Studio 2013 Express
MySQL (I installed nearly everything, connectors, etc, the main version is 5.6 (I think))
In the Qt-directory plugins/sqldrivers there are already the two files qsqlmysql.dll and qsqlmysqld.dll
The methodcall QSqlDatabase::isDriverAvailable( "QMYSQL" ) gives me a "true".
But a call to QSqlDatabase::addDatabase( "QMYSQL" )
gives the warnings:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
So I think the driver is there but it can't be loaded. What is wrong? Do I have to compile some additional things?
Many thanks in advance.
You need to have the path to the mysql dlls in your PATH environment variable. You can add it in the run part of the Project panel
Works - perfect!
To be a little bit more precise for people who will run into the same problem. On my sytem I had to expand the PATH variable with the following path:
C:\Program Files\MySQL\MySQL Server 5.6\lib
BTW: I did not find this essential hint in the current Qt-docs. Is there a way to add it there?
You have the Troubleshooting section of the "SQL Database Driver" chapter in the documentation but it might use that information.
sorry got the same problem but i am not able to fix it...
got qt 5.3 mingw 32 on 64 bit win 7
mysql 5.6 dev install
on linux every thing is fine but Win :(
I guess the problem you encounter now is that the libraries of the downloaded MySQL-distribution are for VisualStudio (not MinGW).
So you must try to fetch the MinGW-libs.
how i change to msvs but still got trouble... can't compline driver ...
It's a bit vague, what errors are you getting ?