I get one exception "SQLiteException: cannot commit - transaction is not active . This exception occurs when I try to update my table in DataBase. I donβt know why this exception occurs and what the value of this exception is. Therefore, if anyone knows, then tell me how I can resolve this exception. In the code, when I replace the update request to insert the request, no error occurs. My update request is like
eg
ContentValues cVal=new ContentValues(); cVal.put("search", 0); int count=sqLiteDatabaseWrite.update("TableName", cVal, null,null);
OR also try
sqLiteDatabaseWrite.execSQL("update TableName set search=0");
In both cases, an error occurs. Here I print my logarithm.
thanks
android.database.sqlite.SQLiteException: cannot commit - no transaction is active at android.database.sqlite.SQLiteStatement.native_executeSql(Native Method) at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:89) at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1928) at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1859) at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:683) at android.database.sqlite.SQLiteStatement.releaseAndUnlock(SQLiteStatement.java:266) at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:96) at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1824) at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1775) at com.ScentSational.SearchProducts.insertIntoProductTable(SearchProducts.java:609) at com.ScentSational.SearchProducts.parseSearchXml(SearchProducts.java:434) at com.ScentSational.SearchProducts$Async_SearchParsing.doInBackground(SearchProducts.java:780) at com.ScentSational.SearchProducts$Async_SearchParsing.doInBackground(SearchProducts.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:252) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574) at java.lang.Thread.run(Thread.java:1020)
source share