android - SQLiteDatabase rawQuery hangs -
i've created android intentservice downloads data remote server , stores in sqlitedatabase. when run service first time runs second time try run ends hanging , i'm not sure why.
c = db.rawquery("select * abc def = ? , ghi = 1", new string[]{integer.tostring(uid)});
it's line hangs i've feeling it's database being locked , it's wait unlock totally wrong. had been getting locking exceptions appear have gone. it's nothing query take while execute because executes instantly , i've waited 5 minutes on second run , still hanging
databasehelper.java
public class databasehelper extends sqliteopenhelper { context context; private sqlitedatabase mdatabase; public databasehelper(context context) { super(context, db_name, null, 10); this.context = context; } public sqlitedatabase getdb() { if ((mdatabase == null) || (!mdatabase.isopen())) { mdatabase = this.getwritabledatabase(); } return mdatabase; }
myapplication.java
public class myapplication extends application { public static databasehelper helper; public static sqlitedatabase database; public myapplication() { super(); } @override public void oncreate(){ super.oncreate(); helper = new databasehelper(this); database = helper.getwritabledatabase(); } @override public void onterminate() { super.onterminate(); if (database != null && database.isopen()) { database.close(); } } }
all database access done using 1 database object in myapplication. insight query hanging appreciated.
logcat
the connection pool database '/data/data/abc/databases/def.sqlite' has been unable grant connection thread 1897 (intentservice[syncservice]) flags 0x1 270.01202 seconds.
Comments
Post a Comment