Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Error in loading SQLITE driver in MeeGo App
Forum Updated to NodeBB v4.3 + New Features

Error in loading SQLITE driver in MeeGo App

Scheduled Pinned Locked Moved Mobile and Embedded
1 Posts 1 Posters 1.6k 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.
  • C Offline
    C Offline
    cef.ramirez
    wrote on last edited by
    #1

    Hi,

    I've run into a weird error while working with databases using QtSql. I created a database using the QSQLITE driver and the default connection name and am able to access it properly. However in my application, I am also using the QMessageService class and according to the logs, it also uses the default connection name and removes the connection I am currently using. After I'm done with the QMessageService class, all my calls to the database are no longer valid since my connection was removed.

    To address this, I tried to define a connection name when I call QSqlDatabase::addDatabase(). The logs report that the database is successfully opened, however, when I try to perform any queries it says that the database driver is not loaded.

    @
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "myConn");
    db.setDatabaseName("myDbName");
    if(db.open()) qDebug() << "Successfully opened database";
    @

    Then any query I perform, the error logs : QSqlError(-1, "Driver not loaded", "Driver not loaded").

    The code was working perfectly without setting the connection name. But the issue with that is that the QMessageService class removes the default connection.

    Why is this so? How can I ensure that my database connection isn't removed by any other process in the system?

    Cef

    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