Using a sqlite3-File from Qt4 and Qt5
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.
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.
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!
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.
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
So I am at my starting point.
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)