PDA

View Full Version : qsqlite QSqlError(-1, "Driver not loaded", "Driver not loaded")



prolink007
24th April 2010, 02:48
Hello Everyone,

I have looked at a few threads on the forums about this topic but could not find one that deals with windows 7 or a windows platform in general.

I have a bit of code here...

currentDB = new QSqlDatabase;
currentDB->addDatabase("QSQLITE");
currentDB->setHostName("broker");
currentDB->setDatabaseName(temp);
currentDB->setUserName("MTG");
currentDB->setPassword("MTG");
if(currentDB->open())
{
qDebug() << "DB opened successfully";
}
else
{
qDebug() << "DB not opened successfully" << currentDB->lastError();
}

Whenever my program gets to this section it complains because...
QSqlError(-1, "Driver not loaded", "Driver not loaded")

I have seen lots of stuff on the internet about this problem, but i am having a really hard time finding a fix for windows. I am trying to use sqlite here.

I am also having the same problem on my linux machine, but i am trying out some of the other threads' suggestions for solving that.

Can someone please help me asap with this problem for windows 7.

Thanks in advance!

prolink007
24th April 2010, 03:43
I actually solved the issue.

Instead i did this...

QSqlDatabase currentDB = QSqlDatabase::addDatabase("QSQLITE");

currentDB.setHostName("MTG");
currentDB.setDatabaseName(temp);
currentDB.setUserName("MTG");
currentDB.setPassword("MTG");
if(currentDB.open())
{
qDebug() << "DB opened successfully";
}
else
{
qDebug() << "DB not opened successfully" << currentDB.lastError();
}

Worked great.