3

In my app, I create a database file that contains multiple tables (let's say 3 tables). An app user emailed me his database file (I save the file to the SD card) after he began experiencing an app crash after updating to the current version of the app. My update did not involve any database changes, it provided support for app-2-SD card functionality, which the user said he used. I'm positive that my code for saving to the SD card works (it's over a year old), but if you'd like more background information, see my other post: Android Database file corruption.

When I open this user's .db file using SQLite Browser, nothing is shown. No tables, no data, etc... When I open the file using a text editor, I can see all of his data. With that being the case, is there a way to "fix" this file somehow?

The crash occurs when the user attempts to open table #1. Simply trying to open the table causes the exception down below. The user tells me that he is able to successfully interact with the app in the areas that access tables #2 and #3. I know he could just delete the files to get past the crash, but then all data is lost, so I'd like to repair it if possible.

...
11-09 22:32:04.275: SELECT locale FROM android_metadata failed
11-09 22:32:04.275: Failed to setLocale() when constructing. closing the database.
11-09 22:32:04.275: ERROR/AndroidRuntime(757): Caused by: android.database.sqlite.SQLiteException: file is encrypted or is not a database
11-09 22:32:04.275: ERROR/AndroidRuntime(757):     at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
11-09 22:32:04.275: ERROR/AndroidRuntime(757):     at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1636)
11-09 22:32:04.275: ERROR/AndroidRuntime(757):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1586)
11-09 22:32:04.275: ERROR/AndroidRuntime(757):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
11-09 22:32:04.275: ERROR/AndroidRuntime(757):     at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:168)

I'm wondering if there is a tool or some guide that I can follow that will help me to fix this particular SQLite file. Thanks.

Community
  • 1
  • 1
Michael
  • 648
  • 11
  • 23
  • Found this link when researching corrupt SQLite dB. [http://superuser.com/questions/111998/repair-firefox-sqlite-databases][1] [1]: http://superuser.com/questions/111998/repair-firefox-sqlite-databases – xQbert Nov 10 '11 at 18:54

0 Answers0