当前位置:   article > 正文

在操作数据库时候出现 sqlite3_open_v2("/data/data/xxx/databases/xxx.db", &handle, 6)failed_db failure: sqlite3_open_v2(at stage of db_check_d

db failure: sqlite3_open_v2(at stage of db_check_database).

最近在做apk升级的时候数据库方出现了如标题一样的问题,一直没找到问题所在,请各位知情人士帮个忙。

 

大概是这样我做了一个应用,需要版本升级,升级的时候应用所用的数据库表字段有所修改,同事增加了新的表,在升级的时候我增加了数据库的版本号,

随后升级之后打开应用程序就会出现这样的错我,自我分析可能是权限问题,但是我是一个相同的应用所以这个不知道是不是正确。下面是执行的代码和

异常信息。

 

代码:

  1. @Override
  2. public void onCreate(SQLiteDatabase db) {
  3. // 执行建表语句
  4. try {
  5. db.execSQL(DBCommon.CREATE_TABLE_GAMETYPE);
  6. db.execSQL(DBCommon.CREATE_TABLE_GAMELIST);
  7. db.execSQL(DBCommon.CREATE_TABLE_ADS);
  8. db.execSQL(DBCommon.CREATE_TABLE_BUYLIST);
  9. db.execSQL(DBCommon.CREATE_TABLE_MOBILECONTROL);
  10. db.execSQL(DBCommon.CREATE_TABLE_DOWNLOAD);
  11. } catch (Exception e) {
  12. e.printStackTrace();
  13. LOG.d(DBG, TAG, "creat table Exception:" + e);
  14. }
  15. LOG.d(DBG, TAG, "SQLiteDatabase onCreate");
  16. }
  17. @Override
  18. public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  19. LOG.d(DBG, TAG, "SQLiteDatabase onUpgrade");
  20. db.execSQL("DROP TABLE IF EXISTS " + DBCommon.TABLE_GAMETYPE);
  21. db.execSQL("DROP TABLE IF EXISTS " + DBCommon.TABLE_GAMELIST);
  22. db.execSQL("DROP TABLE IF EXISTS " + DBCommon.TABLE_ADS);
  23. db.execSQL("DROP TABLE IF EXISTS " + DBCommon.TABLE_BUYLIST);
  24. db.execSQL("DROP TABLE IF EXISTS " + DBCommon.TABLE_MOBILECONTROL);
  25. db.execSQL("DROP TABLE IF EXISTS " + DBCommon.TABLE_DOWNLOADE);
  26. onCreate(db);
  27. }


异常信息:

  1. 08-16 15:41:20.795: I/SqliteDatabaseCpp(26920): sqlite returned: error code = 14, msg = cannot open file at line 27699 of [8609a15dfa], db=/data/data/com.andlisoft.station.game/databases/station.db
  2. 08-16 15:41:20.795: I/SqliteDatabaseCpp(26920): sqlite returned: error code = 14, msg = os_unix.c: open() at line 27699 - "" errno=13 path=/data/data/com.andlisoft.station.game/databases/station.db, db=/data/data/com.andlisoft.station.game/databases/station.db
  3. 08-16 15:41:20.795: E/SqliteDatabaseCpp(26920): sqlite3_open_v2("/data/data/com.andlisoft.station.game/databases/station.db", &handle, 6, NULL) failed
  4. 08-16 15:41:20.945: I/ALSAModule(1868): Terminated ALSA PLAYBACK device hifi
  5. 08-16 15:41:20.980: E/SQLiteDatabase(26920): Failed to open the database. closing it.
  6. 08-16 15:41:20.980: E/SQLiteDatabase(26920): android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file
  7. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
  8. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1013)
  9. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:986)
  10. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1051)
  11. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:802)
  12. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
  13. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
  14. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:157)
  15. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at com.andlisoft.station.game.db.GameTypeDBControl.query(GameTypeDBControl.java:122)
  16. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at com.andlisoft.station.game.model.GameTypeModel.getGameTypeByName(GameTypeModel.java:103)
  17. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at com.andlisoft.station.game.appwidget.WidgetGetData.getData(WidgetGetData.java:26)
  18. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at com.andlisoft.station.game.appwidget.MainWidget.onReceive(MainWidget.java:120)
  19. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2242)
  20. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
  21. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
  22. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.os.Handler.dispatchMessage(Handler.java:99)
  23. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.os.Looper.loop(Looper.java:137)
  24. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at android.app.ActivityThread.main(ActivityThread.java:4575)
  25. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at java.lang.reflect.Method.invokeNative(Native Method)
  26. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at java.lang.reflect.Method.invoke(Method.java:511)
  27. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
  28. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
  29. 08-16 15:41:20.980: E/SQLiteDatabase(26920): at dalvik.system.NativeStart.main(Native Method)
  30. 08-16 15:41:20.980: W/System.err(26920): android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file
  31. 08-16 15:41:20.980: W/System.err(26920): at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
  32. 08-16 15:41:20.980: W/System.err(26920): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1013)
  33. 08-16 15:41:20.980: W/System.err(26920): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:986)
  34. 08-16 15:41:20.980: W/System.err(26920): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1051)
  35. 08-16 15:41:20.980: W/System.err(26920): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:802)
  36. 08-16 15:41:20.980: W/System.err(26920): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
  37. 08-16 15:41:20.980: W/System.err(26920): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
  38. 08-16 15:41:20.980: W/System.err(26920): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:157)
  39. 08-16 15:41:20.980: W/System.err(26920): at com.andlisoft.station.game.db.GameTypeDBControl.query(GameTypeDBControl.java:122)
  40. 08-16 15:41:20.980: W/System.err(26920): at com.andlisoft.station.game.model.GameTypeModel.getGameTypeByName(GameTypeModel.java:103)
  41. 08-16 15:41:20.980: W/System.err(26920): at com.andlisoft.station.game.appwidget.WidgetGetData.getData(WidgetGetData.java:26)
  42. 08-16 15:41:20.980: W/System.err(26920): at com.andlisoft.station.game.appwidget.MainWidget.onReceive(MainWidget.java:120)
  43. 08-16 15:41:20.980: W/System.err(26920): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2242)
  44. 08-16 15:41:20.980: W/System.err(26920): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
  45. 08-16 15:41:20.980: W/System.err(26920): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
  46. 08-16 15:41:20.980: W/System.err(26920): at android.os.Handler.dispatchMessage(Handler.java:99)
  47. 08-16 15:41:20.980: W/System.err(26920): at android.os.Looper.loop(Looper.java:137)
  48. 08-16 15:41:20.980: W/System.err(26920): at android.app.ActivityThread.main(ActivityThread.java:4575)
  49. 08-16 15:41:20.980: W/System.err(26920): at java.lang.reflect.Method.invokeNative(Native Method)
  50. 08-16 15:41:20.980: W/System.err(26920): at java.lang.reflect.Method.invoke(Method.java:511)
  51. 08-16 15:41:20.980: W/System.err(26920): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
  52. 08-16 15:41:20.980: W/System.err(26920): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
  53. 08-16 15:41:20.980: W/System.err(26920): at dalvik.system.NativeStart.main(Native Method)
  54. 08-16 15:41:20.980: E/ZQ_17StationGame_GameTypeDBControl(26920): android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file


还请大家多多帮助。 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/490910
推荐阅读
相关标签
  

闽ICP备14008679号