Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QSqlite db connection error after moving to 5.3
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QSqlite db connection error after moving to 5.3

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 733 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dolevo
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What is the path of your database file ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dolevo
        wrote on last edited by
        #3

        [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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved