SQLite & concurrent access best practices

by Evgeny V » Sun, 09 May 2010 15:06:59 GMT

Sponsored Links
 I believe you can provide the safe concurrency managment by using DB
transactions. Since you don't care about sequence between separate
activities you can run following snippet:

 db.RunCommand(insert or update etc.)


> >

SQLite & concurrent access best practices

by Thierry Legras » Mon, 10 May 2010 06:02:38 GMT

 Thank you both for your answers.

Are you sure using synchronized is enough inside the insert or update? I
also got exceptions in call to getReadableDatabase while another thread was
being writing so i don't think it would work. I am already using transaction
for DB write but it did not seem to make any changes.

The way i do each time i need to read/write/update DB is something like

OnRead() {
 db = new myDBHelperClass();

OnWrite() {
 db = new myDBHelperClass();

I was rather thinking of using a synchronized in OnRead and OnWrite, but has
such methods exists in differents Activities and Task, i am pretty reluctant
to do that.

I also so design were DB is open in Activity onCreate and closed in
onDestroy, but i guess i will not work when a task also needs write in the
DB while the DB is open by the activity.

2010/5/9 Evgeny V <evgen...@gmail.com>




Sponsored Links

Other Threads

1. No permission required for accessing Browser search History


Why is there no permission required to access android's browser search
history ?
Is that data not sensitive enough like the call logs?


2. Making my first Application

I've got the best application for the Android Market! Only problem
is.. I'm not a programmer, developer or any of the things I
desperately need to be for my idea to hit the open Market. Does anyone
have the time to walk me through some steps to get me on my way?


3. database backup

4. Subscription based payment - coming soon?

5. Problem with debug.keystore

6. Paid apps from Developers from countries apart from US and UK

7. groups