android - unknown error (code 14): Could not open database -


i have working app employs database , sqliteassethelper. database file (sql.sqlite) zipped (sql.sqlite.zip) , put in assets/databases folder.

the program works well. , when run second/third/fourth... time starts quickly. if "force stop" followed "clear data" run again, when run (viewing logs) see error "unknown error (code 14): not open database"... wait few seconds , loads , works perfectly.

the log follows:

w/sqliteassethelper(18393): not open database sql.sqlite - unknown error (code 14): not open database w/sqliteassethelper(18393): copying database assets... w/sqliteassethelper(18393): extracting file: 'sql.sqlite'... w/sqliteassethelper(18393): database copy complete i/sqliteassethelper(18393): opened database sql.sqlite 

so looks somehow tried find database, failed, crashed, , repaired itself. question is, how have avoided clumsy start , several seconds of delay?

edit: first reference database in code is...

public class globals extends application {     custom_sqliteassethelper db;        public void oncreate()     {         super.oncreate();         db = new custom_sqliteassethelper(this);         cursor = db.get_first_species_common_name(); 

and have...

public class custom_sqliteassethelper extends sqliteassethelper {     public custom_sqliteassethelper(context context)     {         super(context, "sql.sqlite", null, 1);       }     public cursor get_first_species_common_name()     {         sqlitedatabase db = getreadabledatabase();         sqlitequerybuilder querything = new sqlitequerybuilder();             // etc... 

try change

super(context, "sql.sqlite", null, 1); 

with

 super(context, "sql", null, 1); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -