Hi every body ,
I am using Qt4.4.3 , VS2005 . I wrote a code to connect to database . The is as follows .

Qt Code:
  1. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
  2. db.setDatabaseName("appolice");
  3. db.setHostName("localhost");
  4. db.setUserName("root");
  5. db.setPassword("root");
  6. db.setPort(3307);
  7. if(!db.open())
  8. QMessageBox::information(this,"","Database Connection Failed");
To copy to clipboard, switch view to plain text mode 

I create one QT GUI app and used this code to connect to database , I am able to connect . But I created one more new Qt GUI app where I used same code to connect to data base but it is not able to connect . I didn't get why it is connecting in one application and why it is failed to connect in another application.
Please help me to make connect .

Regards,
Sudheer.