Exception: attempt to acquire a reference on a close SQLiteClosable

This one drove me insane for the longest time. The solution I have found is fairly simple: don’t keep references to SQLiteDatabase objects. Instead, use a SQLiteOpenHelper and call getWritableDatabase() every time you need one. From the docs:

public synchronized SQLiteDatabase getWritableDatabase()

Create and/or open a database that will be used for reading and writing. Once opened successfully, the database is cached, so you can call this method every time you need to write to the database.

The answer was right there the whole time.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)