0 votes
1 view
in Others by (2.5k points)

I am getting following error. So how do I unlock my database?

1 Answer

0 votes
by (7.2k points)

If you forget to close the database. SQLite locks the database when it is writing to it to avoid corruption if at the same time another entity tries to write. Android, will only show an error in log cat, and the query you supplied will be just forgotten...

So, for that I  recommend You to do this:

i)  First you only access the database from one SQLOpenHelper

ii)  If you finished all the instances of database helper you need to close all of them.

iii) You have to make sure you always end transactions with endTransaction() also if you do not set them successful , in case you use transactions

Related questions

0 votes
1 answer
asked Dec 12, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...