Concurrent access
Posted: Wed 23 May 2018 12:12
Hi,
we are using UniDAC 6.3.12 to access SQLite3 databases on Android with Delphi 10.1 Berlin. After a while, we added an Android Service which also writes data into the same database, also with UniDAC / Delphi, in a separate process.
Since then we encountered problems when the two processes tried to write at the same time. Access violations until app restart, corrupted database files. After we switched to WAL mode it is a whole lot better, but not gone completely. We have added the behavior that if an exception is thrown during commit, it tries to commit for two more times, but that didn't help.
As I can see in the SQLite FAQ, SQLite is capable of concurrent write access through file locking. The second process just waits until the first one unlocks the file, if the lock is not released in a specific time, SQLITE_BUSY is returned.
So my question is, is UniDAC able to handle concurrent write access? Are there any properties to set to make the component more concurrent access proof? Do you have any suggestions?
We are not using direct mode.
Thanks
Dominik
we are using UniDAC 6.3.12 to access SQLite3 databases on Android with Delphi 10.1 Berlin. After a while, we added an Android Service which also writes data into the same database, also with UniDAC / Delphi, in a separate process.
Since then we encountered problems when the two processes tried to write at the same time. Access violations until app restart, corrupted database files. After we switched to WAL mode it is a whole lot better, but not gone completely. We have added the behavior that if an exception is thrown during commit, it tries to commit for two more times, but that didn't help.
As I can see in the SQLite FAQ, SQLite is capable of concurrent write access through file locking. The second process just waits until the first one unlocks the file, if the lock is not released in a specific time, SQLITE_BUSY is returned.
So my question is, is UniDAC able to handle concurrent write access? Are there any properties to set to make the component more concurrent access proof? Do you have any suggestions?
We are not using direct mode.
Thanks
Dominik