Reputation: 5938
I am working with SQLite database files, and I notice that when database file is in use, I see that it prints "SQLite error: database is locked". I have tried using SQLiteException with try.catch, but that does not work. What I want to know, is, how can I catch the error before it repeats, and display a message to the user? In other words, what I want to do is set the default retries\timeout for the connection, so that my application does not appear to be unresponsive while it retries.
Upvotes: 3
Views: 1263
Reputation: 2408
To resolve this, simply rename the file and copy it back to it's original name and location.
mv mydata.db temp.db
cp temp.db mydata.db
Your question is similar to the query "How do I unlock a SQLite database?" I think the answers provided for this question will help you to resolve your issue very easily.
Upvotes: 1