Concurrent database access coding
-
wrote on 13 Nov 2021, 02:53 last edited by
We have a program written in Qt that accesses a local Qt SQL database stored on the local hard drive.
I'd like to get an idea of what's involved to modify the program to allow for the database to be stored on a shared volume and concurrently read/write accessed by instances of the program running on several computers.
Thanks!
Tom
-
We have a program written in Qt that accesses a local Qt SQL database stored on the local hard drive.
I'd like to get an idea of what's involved to modify the program to allow for the database to be stored on a shared volume and concurrently read/write accessed by instances of the program running on several computers.
Thanks!
Tom
wrote on 13 Nov 2021, 06:43 last edited by@Tom831
Unfortunately you say nothing about which SQL database back-end you use. If it's SQLite I believe that does not support shared-concurrent access from multiple clients. You will want to use something like MySQL for that, which has a server running on the machine hosting the physical database file. You can then have multiple clients accessing it simultaneously. You will want to learn about transactions to support simultaneous updates, and code accordingly. Qt SQL libraries do support transactions. -
Hi,
Beside @JonB excellent advices, concurrent shared access of SQLite files on network drives is highly discouraged.
See the official SQLite documentation chapter on this matter.
1/3