Here is the stack: 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: 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 the error being 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 a database connection > > using the DBHelper, perform an update on a field in my database and > > 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 an error. > > > The thread is in a View, that also has it's own instance of the > > DBHelper and > > opens the database onCreate > > closes it onPause > > opens it onResume > > closes it onDestroy > > > The instance in my Thread is throwing this but not all the time :error > > code 5: database is locked > > > Is there a known practice I should implement so I don't get this error? > > -- 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