PDA

View Full Version : MySQL Login?



steve.bush
6th April 2011, 20:27
I am trying to do a MySQL login. The connection.open() is returning false with correct details...



QSqlDatabase connection = QSqlDatabase::addDatabase("QMYSQL");
connection.setHostName(host);
connection.setUserName(username);
connection.setPassword(password);
connection.setDatabaseName(database);
connection.setPort(3306);

if(connection.open())
// Load program...



Some help would be great!

stampede
6th April 2011, 22:19
What does connection.isValid() return ?
Does QSqlDatabase::drivers (http://doc.qt.nokia.com/latest/qsqldatabase.html#drivers) contain "QMYSQL" ? In other words, do you have MySql plugin ?