I'm definitely not turning it off.
I'll try explicitly enabling locking as see if it make a difference.

But I'd like to know what busy timeout is being used for Android.
I would hope my app is not falling foul of it.
But I have one (very simple) query what regularly takes about 2
seconds to execute.


On Nov 2, 9:14 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> William,
>
> This:
>
> http://developer.android.com/reference/android/database/sqlite/SQLite...)
>
> suggests that thread-safe locking is enabled by default.
>
> Are you turning it off somewhere, perhaps?
>
> If not, I think you could try calling this method to explicitly enable
> locking.
>
> -- Kostya
>
> 02.11.2010 8:07, William Ferguson пишет:
>
>
>
> > I have seen some other discussions on this issue for Sqlite and the
> > solution was to increase the busy timeout for the DB.
> > Anyone know how that is achieved on Android?
>
> > On Nov 2, 12:14 am, William Ferguson<william.ferguson...@gmail.com>
> > wrote:
> >> I'm seeing the same thing.
>
> >> And to answer the questions:
> >> 1 - There is no other app using my db, though it is accessed from both
> >> my Activity and an IntentService within my app. Both of which needs
> >> write access.
> >> 2 - I closed the cursor every time.
>
> >> I cannot see any need for the entire DB to be locked (there is no DDL
> >> being executed).
> >> But its possible that there is a collision between the 2 Threads. Ie
> >> both trying to write at the same time (though never to the same
> >> record).
> >> But I had presumed that one would halt (unless it times out) waiting
> >> for the first to release a write lock.
> >> But it doesn't look like there is any waiting being done.
> >> Is that an option that can be configure? for an SQLite transaction? I
> >> couldn't find anything that suggested that.
>
> >> Stacktrace below.
>
> >> William
>
> >> 11-01 23:40:30.173: ERROR/Database(8715): Error inserting ..
> >> crane=large length=6
> >>          android.database.sqlite.SQLiteException: error code 5:
> >> database is locked
> >>          at
> >> android.database.sqlite.SQLiteStatement.native_execute(Native Method)
> >>          at
> >> android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:
> >> 66)
> >>          at
> >> android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:
> >> 1426)
> >>          at
> >> android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:
> >> 1286)
>
> >> On Oct 25, 10:48 pm, AJ<ajeet.invinci...@gmail.com>  wrote:
>
> >>> Hi gcstang,
> >>> Very basic but check the following:-
> >>> 1- Is any other app using your DB?
> >>> 2- Did you close the cursor every time when you opened it?
> >>> Thanks,
> >>> AJ
> >>> On Oct 25,5:41 pm, gcstang<gcst...@gmail.com>  wrote:
> >>>> ping, anyone that can answer this?
> >>>> On Oct 16, 10:58 am, gcstang<gcst...@gmail.com>  wrote:
> >>>>> Here is the stack:
> >>>>> android.database.sqlite.SQLiteException:errorcode5:databaseislocked
> >>>>>          at
> >>>>> android.database.sqlite.SQLiteStatement.native_execute(Native Method)
> >>>>>          at
> >>>>> android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:
> >>>>> 55)
> >>>>>          at
> >>>>> android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:
> >>>>> 1779)
> >>>>>          at
> >>>>> android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:
> >>>>> 1709)
> >>>>>          at com.myapp.MyDbAdapter.updateField2(MyDbAdapter.java:468)
> >>>>>          at com.myapp.MyView$13.run(MyView.java:1260)
> >>>>>          at java.lang.Thread.run(Thread.java:1102)
> >>>>> On Oct 15, 11:54 am, DanH<danhi...@ieee.org>  wrote:
> >>>>>> Where is theerrorbeing thrown from?  (You might include the
> >>>>>> exception traceback.)
> >>>>>> On Oct 15, 9:44 am, gcstang<gcst...@gmail.com>  wrote:
> >>>>>>> Has anyone encountered this and is there a solution to work around it?
> >>>>>>> I'm creating a Thread and in that thread I open adatabaseconnection
> >>>>>>> using the DBHelper, perform an update on a field in mydatabaseand
> >>>>>>> close it. I create a separate one in the Thread because if the View is
> >>>>>>> closed the global one for that view is closed, causing my Thread
> >>>>>>> update to throw anerror.
> >>>>>>> The thread is in a View, that also has it's own instance of the
> >>>>>>> DBHelper and
> >>>>>>> opens thedatabaseonCreate
> >>>>>>> closes it onPause
> >>>>>>> opens it onResume
> >>>>>>> closes it onDestroy
> >>>>>>> The instance in my Thread is throwing this but not all the time :error
> >>>>>>> code5:databaseislocked
> >>>>>>> Is there a known practice I should implement so I don't get thiserror?
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to