Developing app in Java for Android. We are simply trying to get a row count of a SQLite DB in an Async Task. When this code is hit it locks the app and we are periodically getting the below msg in logcat:
The connection pool for database ‘/data/user/0/com.xxx.xxxxx/databases/COLLECTED_DB’ has been unable to grant a connection to thread 865 (AsyncTask #3) with flags 0x1 for 30.042002 seconds.
We continue to get this message every 30 secs and it never ends.
The code is here (Never throws the exception and locks at the query):
public int get_row_count(){
Cursor cursor = null;
int count = 0;
try{
if (db == null){
return 0;
}
cursor = db.rawQuery("SELECT * FROM [" + name + "]", null);
count = cursor.getCount();
cursor.close();
return count;
}
catch (SQLException ex){
if (cursor != null){
cursor.close();
}
Log.e("SQLiteError", "get_row_count: ", ex);
return -1;
}
}
We don’t think this can be a resource issue since there are no other connections to the db and the db only has 2-3 rows of data.
Thanks in advance