[Solved] QT & MySQL - What must be done? [Beginner]
-
Hi folks,
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:
qt-opensource-windows-x86-msvc2013_64_opengl-5.3.1
Windows8.1 64bit
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 QPSQL7So 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.
Best regards
Kai -
Hi,
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\libThanks SGaist
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.
-
It's a bit vague, what errors are you getting ?