數據庫操作的異常Cannot perform this operation because the connection pool has been close

數據庫操作的異常Cannot perform this operation because the connection pool has been close


====================問題描述====================
異常日誌如下:
1
2
3
4
5
6
7
8
9
10
11
Caused by: java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.
at android.database.sqlite.SQLiteConnectionPool.throwIfClosedLocked(SQLiteConnectionPool.java:962)
at android.database.sqlite.SQLiteConnectionPool.waitForConnection(SQLiteConnectionPool.java:599)
at android.database.sqlite.SQLiteConnectionPool.acquireConnection(SQLiteConnectionPool.java:348)
at android.database.sqlite.SQLiteSession.acquireConnection(SQLiteSession.java:894)
at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:834)
at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:143)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:196)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:244)


我知道這是數據庫連接被關閉導致的,但是怎麼解決這個問題呢,網上能找到的解決辦法都試了,還是會報這個問題,請教高人指點! 
====================解決方案1====================
那就在使用後才關閉啊 
====================解決方案2====================
是不是沒有關閉cursor,然後再次訪問造成的異常 
====================解決方案3====================
光這麼點代碼難辦啊,最好能描述下db的使用的流程 
====================解決方案4====================
放線程裏有問題,放服務裏沒問題?
是不是線程沒執行完(數據庫沒來得及close)就強制結束了。 
====================解決方案5====================
sqllite 是不支持多線程 同時 讀寫的,是不是這個問題?
原文鏈接:http://www.cnblogs.com/yiguobei99/p/4011071.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章