I have a problem when I want to open a database in Android The code is simple:
db = SQLiteDatabase.openDatabase("db", null, SQLiteDatabase.OPEN_READONLY);
localCursor1 = db.query("table", arrayOfString, null, null, null, null, null);
This database is copied from another app. I am sure that the other app can open the database and I can also open the database with sqlite manager(both the original and the copy)
The problem is that I get these errors(not always the same error):
01-06 20:22:20.740: E/SQLiteLog(9158): (1) near "WHERE": syntax error
01-06 20:22:20.740: E/SQLiteLog(9158): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 20:22:20.740: E/SQLiteLog(9158): (1) near "WHERE": syntax error
01-06 20:22:20.745: E/SQLiteLog(9158): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 20:22:20.745: E/SQLiteLog(9158): (1) near "WHERE": syntax error
01-06 20:22:20.745: E/SQLiteLog(9158): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 20:22:20.745: E/SQLiteLog(9158): (1) near "WHERE": syntax error
01-06 20:22:20.745: E/SQLiteLog(9158): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 20:22:20.745: E/SQLiteLog(9158): (1) near "where": syntax error
01-06 20:22:20.745: E/SQLiteLog(9158): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 20:22:20.745: E/SQLiteLog(9158): (1) near "WHERE": syntax error
01-06 20:22:20.745: E/SQLiteLog(9158): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 20:22:20.750: E/SQLiteLog(9158): (11) malformed database schema (part_idx_MESSAGES_LIKES_read_0) - near "WHERE": syntax error
01-06 20:22:20.795: E/DefaultDatabaseErrorHandler(9158): Corruption reported by sqlite on database: db
01-06 20:22:20.795: E/DefaultDatabaseErrorHandler(9158): !@ make .back file
01-06 20:22:21.065: E/SQLiteLog(9158): (14) cannot open file at line 30241 of [00bb9c9ce4]
01-06 20:22:21.070: E/SQLiteLog(9158): (14) os_unix.c:30241: (2) open(db) -
01-06 20:22:21.285: E/SQLiteDatabase(9158): Failed to open database 'db'.
01-06 20:22:21.285: E/SQLiteDatabase(9158): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:279)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:464)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:186)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:178)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:792)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:669)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.os.Handler.dispatchMessage(Handler.java:99)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.os.Looper.loop(Looper.java:137)
01-06 20:22:21.285: E/SQLiteDatabase(9158): at android.os.HandlerThread.run(HandlerThread.java:60)
01-06 21:04:23.355: D/open db(17769): db
01-06 21:04:23.570: E/SQLiteLog(17769): (1) near "WHERE": syntax error
01-06 21:04:23.570: E/SQLiteLog(17769): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 21:04:23.570: E/SQLiteLog(17769): (1) near "WHERE": syntax error
01-06 21:04:23.570: E/SQLiteLog(17769): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 21:04:23.570: E/SQLiteLog(17769): (1) near "WHERE": syntax error
01-06 21:04:23.570: E/SQLiteLog(17769): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 21:04:23.570: E/SQLiteLog(17769): (1) near "WHERE": syntax error
01-06 21:04:23.570: E/SQLiteLog(17769): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 21:04:23.585: E/SQLiteLog(17769): (1) near "where": syntax error
01-06 21:04:23.585: E/SQLiteLog(17769): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 21:04:23.590: E/SQLiteLog(17769): (1) near "WHERE": syntax error
01-06 21:04:23.590: E/SQLiteLog(17769): (11) database corruption at line 93752 of [00bb9c9ce4]
01-06 21:04:23.595: E/SQLiteLog(17769): (11) malformed database schema (part_idx_MESSAGES_LIKES_read_0) - near "WHERE": syntax error
01-06 21:04:23.595: D/ open cursor exception(17769): malformed database schema (part_idx_MESSAGES_LIKES_read_0) - near "WHERE": syntax error (code 11): , while compiling: SELECT address FROM messages WHERE date>? ORDER BY date asc
01-06 21:25:39.015: E/DefaultDatabaseErrorHandler(25049): !@ openDatabase - Exception during copying and renaming
Usually you can open the database but you get an error on any query(the queries are correct). db is deleted and db.back is created. It is not a cache problem, I have uninstalled the application and deleted the old files. It's not something related to a task killer. This is something that always happens. I have done a few hundred tests and I can not open the database.
Aucun commentaire:
Enregistrer un commentaire