PDA

View Full Version : Regarding MYSQL connection



sudheer168
16th October 2009, 06:24
Hi ,
I am using qt-win-commercial-4.4.3-vs2005 and integrated to MSVS2005 using qt-vsintegration-1.3.3 on windows. Now if I use to connect the sqlite database connection its working well.But if I use to connect the MYSQL connection its showing driver not loaded.I looked at" C:\Qt\4.4.3\plugins\sqldrivers" all the dll's are there.So now to make a MYSQL connection shall I have plugin it or what all I have to do for the package I am using.I also installed Mysql(MySQL Server 5.0)
please suggest me to get out of this problem.

The code I used to connect is shown below.



QSqlDatabase db = QSqlDatabase::addDatabase( "QMYSQL" );
db.setDatabaseName( "data" );
if ( !db.open())
{
QMessageBox::information(0,"","Failed to open database:"+ db.lastError().driverText());
qWarning( "Failed to open database: " + db.lastError().driverText() );
qWarning( db.lastError().databaseText() );
return 1;
}


Regards,
Sudheer.

wysota
16th October 2009, 09:05
Check that dependencies for the mysql driver are met (i.e. using Dependency Walker).

sudheer168
16th October 2009, 09:55
Hi,
thanks for your quick reply. I am sorry to say that I can't understand what you have suggested to me .I request you to tell little bit clearly. To make coomunicate with MYSQl through Qt code what all I have to do according to my Package.

So please help me to get out of this problem

Regards,
Sudheer.

wysota
16th October 2009, 15:34
STFW for "dependency walker".