3
回答
Android 访问数据库报错,什么原因
11-21 06:32:38.150: E/Database(1254): close() was never explicitly called on database '/data/data/com.bankb2c.activity/databases/BankService.db'
11-21 06:32:38.150: E/Database(1254): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
11-21 06:32:38.150: E/Database(1254):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1810)
11-21 06:32:38.150: E/Database(1254):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:817)
11-21 06:32:38.150: E/Database(1254):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:851)
11-21 06:32:38.150: E/Database(1254):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:844)
11-21 06:32:38.150: E/Database(1254):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:540)
11-21 06:32:38.150: E/Database(1254):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
11-21 06:32:38.150: E/Database(1254):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
11-21 06:32:38.150: E/Database(1254):     at com.bankb2c.db.BankDbAdapter.open(BankDbAdapter.java:71)
11-21 06:32:38.150: E/Database(1254):     at com.bankb2c.activity.GroupbuySelectAddressActivity$MyAdapter.getCount(GroupbuySelectAddressActivity.java:80)
11-21 06:32:38.150: E/Database(1254):     at android.widget.ListView.onMeasure(ListView.java:1081)
11-21 06:32:38.150: E/Database(1254):     at android.view.View.measure(View.java:8171)
11-21 06:32:38.150: E/Database(1254):     at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
11-21 06:32:38.150: E/Database(1254):     at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
11-21 06:32:38.150: E/Database(1254):     at android.view.View.measure(View.java:8171)
11-21 06:32:38.150: E/Database(1254):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-21 06:32:38.150: E/Database(1254):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
11-21 06:32:38.150: E/Database(1254):     at android.view.View.measure(View.java:8171)
11-21 06:32:38.150: E/Database(1254):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-21 06:32:38.150: E/Database(1254):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
11-21 06:32:38.150: E/Database(1254):     at android.view.View.measure(View.java:8171)
11-21 06:32:38.150: E/Database(1254):     at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
11-21 06:32:38.150: E/Database(1254):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
11-21 06:32:38.150: E/Database(1254):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 06:32:38.150: E/Database(1254):     at android.os.Looper.loop(Looper.java:123)
11-21 06:32:38.150: E/Database(1254):     at android.app.ActivityThread.main(ActivityThread.java:4627)
11-21 06:32:38.150: E/Database(1254):     at java.lang.reflect.Method.invokeNative(Native Method)
11-21 06:32:38.150: E/Database(1254):     at java.lang.reflect.Method.invoke(Method.java:521)
11-21 06:32:38.150: E/Database(1254):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-21 06:32:38.150: E/Database(1254):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-21 06:32:38.150: E/Database(1254):     at dalvik.system.NativeStart.main(Native Method)
11-21 06:32:38.181: E/Cursor(1254): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.bankb2c.activity/databases/BankService.db, table = addressTbl, query = SELECT * FROM addressTbl
11-21 06:32:38.181: E/Cursor(1254): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
11-21 06:32:38.181: E/Cursor(1254):     at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
11-21 06:32:38.181: E/Cursor(1254):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
11-21 06:32:38.181: E/Cursor(1254):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
11-21 06:32:38.181: E/Cursor(1254):     at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1229)
11-21 06:32:38.181: E/Cursor(1254):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1184)
11-21 06:32:38.181: E/Cursor(1254):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1264)
11-21 06:32:38.181: E/Cursor(1254):     at com.bankb2c.db.BankDbAdapter.listAddress(BankDbAdapter.java:113)
11-21 06:32:38.181: E/Cursor(1254):     at com.bankb2c.activity.GroupbuySelectAddressActivity$MyAdapter.getCount(GroupbuySelectAddressActivity.java:81)
11-21 06:32:38.181: E/Cursor(1254):     at android.widget.AdapterView.checkFocus(AdapterView.java:689)
11-21 06:32:38.181: E/Cursor(1254):     at android.widget.ListView.setAdapter(ListView.java:437)
11-21 06:32:38.181: E/Cursor(1254):     at com.bankb2c.activity.GroupbuySelectAddressActivity.onCreate(GroupbuySelectAddressActivity.java:51)
11-21 06:32:38.181: E/Cursor(1254):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-21 06:32:38.181: E/Cursor(1254):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-21 06:32:38.181: E/Cursor(1254):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-21 06:32:38.181: E/Cursor(1254):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-21 06:32:38.181: E/Cursor(1254):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-21 06:32:38.181: E/Cursor(1254):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 06:32:38.181: E/Cursor(1254):     at android.os.Looper.loop(Looper.java:123)
11-21 06:32:38.181: E/Cursor(1254):     at android.app.ActivityThread.main(ActivityThread.java:4627)
11-21 06:32:38.181: E/Cursor(1254):     at java.lang.reflect.Method.invokeNative(Native Method)
11-21 06:32:38.181: E/Cursor(1254):     at java.lang.reflect.Method.invoke(Method.java:521)
11-21 06:32:38.181: E/Cursor(1254):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-21 06:32:38.181: E/Cursor(1254):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-21 06:32:38.181: E/Cursor(1254):     at dalvik.system.NativeStart.main(Native Method)

举报
蓝色鸣鸟
发帖于6年前 3回/1K+阅
顶部