数据库操作的异常Cannot perform this operation because the connection pool has been close
2014-11-12 11:03
661 查看
============问题描述============
异常日志如下:
我知道这是数据库连接被关闭导致的,但是怎么解决这个问题呢,网上能找到的解决办法都试了,还是会报这个问题,请教高人指点!
============解决方案1============
那就在使用后才关闭啊
============解决方案2============
是不是没有关闭cursor,然后再次访问造成的异常
============解决方案3============
光这么点代码难办啊,最好能描述下db的使用的流程
============解决方案4============
放线程里有问题,放服务里没问题?
是不是线程没执行完(数据库没来得及close)就强制结束了。
============解决方案5============
sqllite 是不支持多线程 同时 读写的,是不是这个问题?
异常日志如下:
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 是不支持多线程 同时 读写的,是不是这个问题?
相关文章推荐
- 数据库操作的异常Cannot perform this operation because the connection pool has been close
- 数据库操作的异常Cannot perform this operation because the connection pool has been close
- 数据库操作的异常Cannot perform this operation because the connection pool has been close
- java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been
- Cannot perform this operation because the connection pool has been closed
- Android ava.lang.IllegalStateException: Cannot perform this operation because the connection pool ha
- Android Cannot perform this operation because the transaction has already been marked successful
- Android开发中出现java.lang.IllegalStateException: Cannot perform this operation because the connection。。。
- SharePoint Designer Check In and Check Out Error – Cannot perform this operation.The file is no longer check out or has been del
- Cannot perform this operation because there is no current transaction(不能执行此操作,因为没有当前事务。)
- The operation cannot be completed because the DbContext has been disposed
- SharePoint Designer Can not perform this operation.The file is no longer checked out or has been del
- mysql出现Connection.close() has already been called. Invalid operation in this state.
- Couldn't perform the operation rollback: You can't perform any operations on this connection. It has
- “The operation cannot be completed because the DbContext has been disposed” exception with lazy load disabled
- Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions
- 【SSH异常系列】Cannot call sendError() after the response has been committed
- the operation has been canceled due to restrictions in effect on this computer
- 数据库连接异常Cannot get a connection, pool error Timeout waiting for idle object
- AsyncTask时异常: Cannot execute task: the task has already been executed (a task can be executed only o