[SOLVED] QSqlite db connection error after moving to 5.3



  • Hi all,

    I was using Qt 4.8 and below function runs perfect there without any connection issue:

    @bool DataBase::mp_DB_CONNECTION_ConnectWithDB(QString dbpath)
    {
    db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(dbpath);
    if(db.open()==true)
    {
    return true;
    }
    else
    {
    qDebug() << "[ERROR]" << db.lastError();
    return false;
    }
    } @

    Now I moved to 5.3 and db.lastError throws the following error:
    @QSqlError("", "Error opening database", "out of memory")@

    I have searched some but couldn't find any answer. Is it possible that the QSQLITE driver is somehow missing in 5.3? How can I check it?


  • Lifetime Qt Champion

    Hi,

    What is the path of your database file ?



  • [quote author="SGaist" date="1406618127"]Hi,

    What is the path of your database file ?[/quote]

    Yeah, that was the problem.
    I recently copied the project to another folder and QCoreApplication::applicationDirPath() was pointing to the old location.
    Thanks a lot.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.