I need access to a MySQL-Database in one of my Qt 4.0.0 programmes. I got a message: "Driver not loaded, Driver not loaded", when I tried the following code:
Qt Code:
db.setHostName("localhost"); db.setDatabaseName("testdb"); db.setUserName("root"); db.setPassword(""); bool ok = db.open(); if(ok)setText("it works"); else setText(db.lastError().text());To copy to clipboard, switch view to plain text mode
In the docs, it says:
"
You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MYSQL):
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pro
nmake
"
I have never installed any MySQL and I don't understand why I have to do this. After all, I don't necessarily want to access a database on my computer, it could also be on a remote computer where MySQL is installed. So I think I must have got something wrong. Can you tell me what to do?
Thanks.
Bookmarks