I am using Qt Creator 2.4.1 in windows . While connecting to the database ,I am getting the following error
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
Following is the code snippet :
Qt Code:
db.setHostName( "localhost" ); db.setDatabaseName( "testdb" ); db.setUserName( "root" ); db.setPassword( "password" ); if( !db.open() ) { qDebug() << db.lastError(); qDebug() <<QSqlDatabase::drivers() ; qFatal( "Failed to connect." ); } qDebug( "Connected!" ); db.close();To copy to clipboard, switch view to plain text mode
Regards ,
Prachi
Bookmarks