SQLite Forum

Is there a way to wait until the database is available?
Wrong question. As you explained in your other post, you are expecting a deadlock to occur. By definition, no amount of waiting will resolve a deadlock. (At least) one of the processes involved in the deadlock has to release the resources it has acquired and start over. The proper response to SQLITE_BUSY as an indication of deadlock is to ROLLBACK and then repeat the transaction.