SQLite抛出错误“未关闭游标及数据库对象”特殊原因一例

WBOY
Release: 2016-06-07 17:11:21
Original
1120 people have browsed it

SQLite抛出错误ldquo;未关闭游标及数据库对象rdquo;特殊原因一例

Html代码

LogCat 报错信息:

发生错误原因分析:

主要错误:

出错处代码

SQLiteDatabase db = getWritableDatabase();

意思是指在此处打开数据库操作之前,应用程序没有关闭游标或数据库对象。

在应用中,对数据库操作完成后,应该对游标及数据库进行关闭操作

检查操作数据库的相关源代码,确认在退出前关闭了游标及数据库对象。

那还抛出未关闭的错误是怎么回事呢?继续检查发现,抛出此错误之前,在操作数据库过程中还抛出了另外的一个错误。

原来在抛出第一个错误以后,,关闭操作未执行,导致再次操作数据库时抛出“应用程序没有关闭游标或数据库对象”的错误。

解决办法:

检查数据库操作部分代码,在抛出错误处理部分,关闭游标及数据库对象(cursor or database object)

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!