Android Exception 7 (attempt to re-open an Already-closed object)

Source: Internet
Author: User

07-23 18:16:17.641:w/sqliteconnectionpool (28390): A sqliteconnection object for database '/storage/emulated/0/cnoa.db ' Was leaked!  
Fix your application to end transactions in progress properly and to close the database when it is no longer needed .

This error occurs because I call another database query method in a database query method, my database query method is to get the Sqlitedatabase object at the beginning, and close the Sqlitedabse object at the end, Results of the Internal database query method at the end of the direct shutdown of the Sqlitedatabase object, resulting in an error outside the database query operation, here you do not think that more than a few sqlitedatabase objects can be, Each thread can use only one sqliteopenhelper, which makes it possible for each thread to use a Sqlitedatabase object (the multithreaded operation database will error);

The solution is that I no longer close the Sqlitedatbase object of the Internal database query method or integrate that method directly into the query method outside, of course, to ensure that this query method only appears in other database query methods, if you use this method alone, On the contrary, because the Sqlitedatabase object is not closed and error ;

Text Source: http://blog.csdn.net/zhufuing/article/details/14455823

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.