PDA

View Full Version : QMYSQL driver not loaded



akhila
22nd February 2010, 09:49
hi,
i'm completely new to Qt and i am trying to connect to mysql database. When i run this qt program on DEBIAN using qt creator,


int main(int argc, char *argv[])
{
QApplication a(argc, argv);
new1 w;

qDebug() << QSqlDatabase::drivers();

QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );

qDebug() << db.lastError();
w.show();
}



i get this error...

("QSQLITE", "QPSQL7", "QPSQL")
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QPSQL7 QPSQL
QSqlError(-1, "Driver not loaded", "Driver not loaded")


i googled a lot and dint get this working still.. can someone help me out with this???

i happened to search the forum, dint get an answer...
thank you..

schnitzel
22nd February 2010, 18:24
Hello akhila,

Welcome to Qt.
Your issue has been discussed many times, please check 'Similar Threads' further down on this page or search the forum.
You may have to build the plugin first as this is not done by default. More info can be found here:
http://doc.qt.nokia.com/4.6/sql-driver.html#qmysql-for-mysql-4-and-higher

good luck