On 3 May 2015, at 2:03am, Scott Doctor <scott at scottdoctor.com> wrote:
> To review, after opening the database, issue the PRAGMA busy_timeout = x, > with x being however long I want to wait before aborting. Yes. Since you have two copies of one program, I don't need to say this for you, but for other people, the PRAGMA needs to be issued by all programs with a connection to the database. The value is associated with the connection, it's not stored in the database or the journal. > I can keep both database handles open at the same time, but need to make sure > I finalize the operation before the timeout happens (assuming the other > program is also trying to access the database at the same time). Yes. Though you shouldn't be intentionally holding a transaction (i.e. a lock) open for minutes at a time in a multi-access environment. Don't try to second-guess the retry schedule. It's quite possible, for instance, that if process B has to retry and backs off for 1000 milliseconds, process A has unlocked, locked, unlocked, locked, unlocked, and locked again in that time. So don't try to set your timeout according to what you think can happen in one transaction, set a timeout of at least a couple of minutes -- long enough that you can be really sure the other process has messed up in a big way and have to reluctantly inform your user of that fact. Simon.

