Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. "SQL logic error or missing database Error opening database"
Qt 6.12 LTS is out! See what's new in the release blog

"SQL logic error or missing database Error opening database"

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 4.1k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I'm trying to incorporate a database within the application, by changing the offlinestorage path. So far i've successfully made it work on the simulator but when i run it on a device i'm getting the following error: "SQL logic error or missing database Error opening database".
    Has this happened to someone else?

    Thank you.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Please check what are the drivers available in your system then connect that drivers.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Which drivers?


        Btw, the database i'm trying to incorporate was created in the simulator and copied from "....\Nokia\QtSimulator\data\QML\OfflineStorage\Databases".

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          So it happens i was using the same path for both simulator and device, which is not correct.
          I can access the database with:

          @#ifdef Q_WS_SIMULATOR
          viewer.engine()->setOfflineStoragePath(<PATH>);
          #else
          QString privatePathQt(QApplication::applicationDirPath());
          QString pathOfflineStorage(privatePathQt);
          pathOfflineStorage.append(QDir::separator()).append(<PATH>);
          pathOfflineStorage = QDir::toNativeSeparators(pathOfflineStorage);
          viewer.engine()->setOfflineStoragePath(pathOfflineStorage);
          #endif@

          Now i can access it but i can't edit it permanently.
          I run it in the simulator, make some changes in a table and when i restart it the changes are not saved.

          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
          • Unsolved