Hello.

I am iterating through a System.Data.DataTable row by row and Inserting into
SQLite using ContentValues and WriteDatabaseTable.Insert(...)

It's crashing after a couple of hundred rows with the following error. I
don't know why "close()" is being called. What is the best way to insert a
large number of rows a into SQLite table?

Any help is much appreciated:

05-16 17:58:52.920: ERROR/SQLiteDatabase(3346): close() was never explicitly
called on database '/data/data/com.mydomain.android.pos/databases/POS' 
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):
android.database.sqlite.DatabaseObjectNotClosedException: Application did
not close the cursor or database object that was opened here
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1980)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:977)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:956)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1021)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:734)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:149)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:223)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
streetteam.Act_Login.n_onCreate(Native Method)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
streetteam.Act_Login.onCreate(Act_Login.java:25)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.app.ActivityThread.access$1500(ActivityThread.java:122)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.os.Handler.dispatchMessage(Handler.java:99)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.os.Looper.loop(Looper.java:132)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
android.app.ActivityThread.main(ActivityThread.java:4025)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
java.lang.reflect.Method.invokeNative(Native Method)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
java.lang.reflect.Method.invoke(Method.java:491)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-16 17:58:52.920: ERROR/SQLiteDatabase(3346):     at
dalvik.system.NativeStart.main(Native Method)
05-16 17:58:52.920: INFO/dalvikvm(3346): Uncaught exception thrown by
finalizer (will be discarded):
05-16 17:58:52.920: INFO/dalvikvm(3346): java.lang.IllegalStateException:
Don't have database lock!
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.database.sqlite.SQLiteDatabase.verifyLockOwner(SQLiteDatabase.java:2131)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.database.sqlite.SQLiteDatabase$1.entryRemoved(SQLiteDatabase.java:2223)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.database.sqlite.SQLiteDatabase$1.entryRemoved(SQLiteDatabase.java:2219)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.util.LruCache.trimToSize(LruCache.java:197)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.util.LruCache.evictAll(LruCache.java:285)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.database.sqlite.SQLiteDatabase.deallocCachedSqlStatements(SQLiteDatabase.java:2184)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.database.sqlite.SQLiteDatabase.closeClosable(SQLiteDatabase.java:1096)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
android.database.sqlite.SQLiteDatabase.finalize(SQLiteDatabase.java:1950)
05-16 17:58:52.920: INFO/dalvikvm(3346):     at
dalvik.system.NativeStart.run(Native Method)


--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Insert-2000-rows-into-SQLite-tp4401830p4401830.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to