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. Using a sqlite3-File from Qt4 and Qt5
Forum Updated to NodeBB v4.3 + New Features

Using a sqlite3-File from Qt4 and Qt5

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.4k 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.
  • R Offline
    R Offline
    rakor
    wrote on 26 Oct 2013, 10:49 last edited by
    #1

    Hi,

    I am migrating all projects from Qt4 to Qt5. There are 3 projects working on the same sqlite3-database-file. Having all projects running with Qt4 there was no problem.

    Now I have switched the first project to Qt5 and suddenly the database gets locked. I don't know why there was this lock, but it was not able to write to the database (with no project).

    Is there a difference within the sqlite3-drivers used in Qt4 and Qt5 that makes it impossible to use both on the same db-file (especially in case of write-locks)?

    I have switched back to Qt4 until this issue is better known to me.

    Thank you!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 28 Oct 2013, 10:14 last edited by
      #2

      Hi,

      I don't know if SQLITE driver was changed from Qt4 to Qt5; I know that SQLite changed locking mechanism.

      Are you using system sqlite or qt bundled one?

      Check what SQLite version are you using qith Qt4 and Qt5.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rakor
        wrote on 28 Oct 2013, 15:28 last edited by
        #3

        OK I have investigated this problem a little. I am using sqlite-drivers shipped with Qt and then I use the Qt-Classes for handling all the databasestuff.

        I found out, that if there is one application opened (using the database) no other can write to it (getting the Error "database is locked Unable to fetch row") even if the first application is not writing anything to the database.

        Thats strange to me and with Qt4 I could use the same db with lots of applications. If more than one of them wanted to write to the db the others had to wait until the first one was finished.

        Could you give me a hint why this happens, and how I could avoid it? I need to have some applications using the db in parallel.

        Thanks a lot!

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on 28 Oct 2013, 16:06 last edited by
          #4

          Hi,

          SQLite is a file based database system; it uses some mechanisms to avoid data collision and to provide data safety when multiple thread/process try to use the same file at the same time.

          Probably SQLite shipped with Qt5 uses different mechanism to handling multiple connections respect with the one shipped with Qt4; you should verify on SQLite website.

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rakor
            wrote on 29 Oct 2013, 14:23 last edited by
            #5

            Hmm... circulus vitiosus...

            At sqlite I got the hint that it might be a problem of Qt....

            bq. Sounds like something changed in Qt 5.1.1 so that it is holding open a read
            transaction. The first process acquires the read transaction, which
            permits other processes to read but prevents anybody else from writing. I
            have no idea why Qt would do this, though.
            [...]
            I think your goal should be to figure out why Qt 5.1.1 is holding open the
            read transaction.

            So I am at my starting point.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 29 Oct 2013, 21:14 last edited by
              #6

              Hi,

              Since it's getting low-level, you should try asking on the interest mailing list (with this last information) you'll find Qt's maintainers/developers there (this forum is more user oriented)

              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

              1/6

              26 Oct 2013, 10:49

              • Login

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