PDA

View Full Version : after plugin Mysql n Qt..??



kazal
23rd June 2010, 09:44
Hi..
i'm new to Qt progrmming..

i want to use Mysql server 5.1 as my database in Qt sdk 4.6.2..

so i already plugin Mysql onto qt and have these files(well i dont know what these files for)

lqsqlmysql4.dll, lqsqlmysqld4.dll, qsqlmysql4.a and qsqlmysqld4.a in %QTDIR%\plugin\drivers\mysql

and after that i dont know where to start.. could ur please give me website for starting using database in QT creator..
or example or what so ever

and i also try to load the driver mysql but i cannot load

in main.cpp


#include <QtGui/QApplication>
#include <QtSql>
#include <QtCore>

#include "database.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSqlDatabase *db = new QSqlDatabase;
db->addDatabase("QMYSQL", "mysql");
db->setHostName("localHost");
db->setDatabaseName("MySQL5");
db->setUserName("root");
db->setPassword("root");
if(!db->open()){
qDebug()<<db->lastError().text();
}

delete db;


return a.exec();
}

but application output said that the driver not load..

so i hope ur could give me some help..thanks