Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"SQLiteDiskIOException: error code 10: disk I/O error" retuns on ICS and Samsung Nexus on DROP TABLE

I'm getting the following error:

android.database.sqlite.SQLiteDiskIOException: error code 10: disk I/O error
    at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
    at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:92)
    at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1926)
    at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1866)

I only get this error on ICS 4.0.1 on a Samsung Nexus phone. On an emulator, a Motorola Xoom 3.2 and an HTC Desire 2.3.3, the code works fine. My code is targeted at version 8, or 2.2.x, of the SDK. The execSQL is executed as follows:

db.execSQL("DROP TABLE IF EXISTS " + table.getTableName());

The database is stored internally and not on an SD card. Any suggestions on how to solve this problem?

like image 758
malcooke Avatar asked Dec 15 '11 12:12

malcooke


1 Answers

Solved this.

Problem was that prior to the drop table statements there was a Context.deleteDatabase('dbName') statement which had obviously removed the db, and the I/O error being reported then makes perfect sense.

It seems that a belt and braces approach had been used previously (unnecessarily).

However the interesting thing is that this didn't manifest as a problem until the move to ICS.

like image 54
malcooke Avatar answered Oct 23 '22 05:10

malcooke