android.database.sqlite.SQLiteException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • GTab with access denied to all app databases
    via Android Enthusiasts by SiriusB
    ,
  • is the CPU pegged?
    via by billy...@gmail.com,
  • h4. Problem Description When building to android I get regular occasional errors when building to the device which fails to initialise the app. h4. Actual Results Here is the DDMS error: {code} 04-05 15:36:30.609: E/TiApplication(32009): (main) [348,985] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to create application uk.co.spiritquest.sfl11b1.ScifilondonApplication: android.database.sqlite.SQLiteException: unable to open database file; Titanium 2.0.0,2012/03/30 10:33,b091bae 04-05 15:36:30.609: E/TiApplication(32009): java.lang.RuntimeException: Unable to create application uk.co.spiritquest.sfl11b1.ScifilondonApplication: android.database.sqlite.SQLiteException: unable to open database file 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3812) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.access$2200(ActivityThread.java:132) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1082) 04-05 15:36:30.609: E/TiApplication(32009): at android.os.Handler.dispatchMessage(Handler.java:99) 04-05 15:36:30.609: E/TiApplication(32009): at android.os.Looper.loop(Looper.java:150) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.main(ActivityThread.java:4277) 04-05 15:36:30.609: E/TiApplication(32009): at java.lang.reflect.Method.invokeNative(Native Method) 04-05 15:36:30.609: E/TiApplication(32009): at java.lang.reflect.Method.invoke(Method.java:507) 04-05 15:36:30.609: E/TiApplication(32009): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 04-05 15:36:30.609: E/TiApplication(32009): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 04-05 15:36:30.609: E/TiApplication(32009): at dalvik.system.NativeStart.main(Native Method) 04-05 15:36:30.609: E/TiApplication(32009): Caused by: android.database.sqlite.SQLiteException: unable to open database file 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteDatabase.dbopen(Native Method) 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1956) 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:902) 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:208) 04-05 15:36:30.609: E/TiApplication(32009): at org.appcelerator.titanium.util.TiDatabaseHelper.getPlatformParam(TiDatabaseHelper.java:73) 04-05 15:36:30.609: E/TiApplication(32009): at org.appcelerator.titanium.util.TiPlatformHelper.initialize(TiPlatformHelper.java:69) 04-05 15:36:30.609: E/TiApplication(32009): at org.appcelerator.titanium.TiApplication.postAppInfo(TiApplication.java:349) 04-05 15:36:30.609: E/TiApplication(32009): at uk.co.spiritquest.sfl11b1.ScifilondonApplication.onCreate(ScifilondonApplication.java:34) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:984) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3809) 04-05 15:36:30.609: E/TiApplication(32009): ... 10 more {code} h4. Expected results the DB working fine h4. Test Case 1. Create New mobile project 2. Add this code: {code} var win = Ti.UI.createWindow(); var l = Titanium.UI.createLabel({ text:'See Log for output', top:10, left:10, height:'auto', width:'auto' }); win.add(l); var b1 = Titanium.UI.createButton({ title:'DB in 2nd Context', width:200, height:40, top:40 }); win.add(b1); b1.addEventListener('click', function() { var win1 = Titanium.UI.createWindow({ url:'database_2.js', height:30, width:280, borderRadius:10, bottom:80, backgroundColor:'#333' }); var l1 = Titanium.UI.createLabel({ text:'2nd context test - see log.', color:'#fff', font:{fontSize:14}, width:'auto', height:'auto' }); win1.add(l1); win1.open(); }); var b2 = Titanium.UI.createButton({ title:'Pre-packaged DB', width:200, height:40, top:100 }); win.add(b2); b2.addEventListener('click', function() { var win2 = Titanium.UI.createWindow({ url:'database_3.js', height:30, width:280, borderRadius:10, bottom:140, backgroundColor:'#333' }); var l2= Titanium.UI.createLabel({ text:'Pre-packaged Db - see log.', color:'#fff', font:{fontSize:14}, width:'auto', height:'auto' }); win2.add(l2); win2.open(); }); var l3 = Titanium.UI.createLabel({ text:'unicode placeholder', width:300, height:40, top:190 }); win.add(l3); if (Ti.Platform.osname !== 'android') { win.add(l3); var b3 = Titanium.UI.createButton({ title:'Check DB FullPath', width:200, height:40, top:150 }); b3.addEventListener('click', function() { var path = db.file; alert("mysql.db fullpath : \n \nType :" + path +"\n\nFullPath: "+path.nativePath); }); win.add(b3); } var db = Titanium.Database.open('mydb'); db.execute('CREATE TABLE IF NOT EXISTS DATABASETEST (ID INTEGER, NAME TEXT)'); db.execute('DELETE FROM DATABASETEST'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',1,'Name 1'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',2,'Name 2'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',3,'Name 3'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',4,'Name 4'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)', 5, '\u2070 \u00B9 \u00B2 \u00B3 \u2074 \u2075 \u2076 \u2077 \u2078 \u2079'); var updateName = 'I was updated'; var updateId = 4; db.execute('UPDATE DATABASETEST SET NAME = ? WHERE ID = ?', updateName, updateId); db.execute('UPDATE DATABASETEST SET NAME = "I was updated too" WHERE ID = 2'); db.execute('DELETE FROM DATABASETEST WHERE ID = ?',1); Titanium.API.info('JUST INSERTED, rowsAffected = ' + db.rowsAffected); Titanium.API.info('JUST INSERTED, lastInsertRowId = ' + db.lastInsertRowId); var rows = db.execute('SELECT * FROM DATABASETEST'); Titanium.API.info('ROW COUNT = ' + rows.getRowCount()); Titanium.API.info('ROW COUNT = ' + rows.getRowCount()); Titanium.API.info('ROW COUNT = ' + rows.getRowCount()); while (rows.isValidRow()) { Titanium.API.info('ID: ' + rows.field(0) + ' NAME: ' + rows.fieldByName('name') + ' COLUMN NAME ' + rows.fieldName(0)); if (rows.field(0)==5) { l3.text = rows.fieldByName('name'); } rows.next(); } rows.close(); db.close(); // close db when you're done to save resources win.open(); {code} h4. Extra info Also the Studio Console failed to build prior to the above error: I will have to add that as a comment when i encounter it next.
    via by Ketan Majmudar,
  • h4. Problem Description When building to android I get regular occasional errors when building to the device which fails to initialise the app. h4. Actual Results Here is the DDMS error: {code} 04-05 15:36:30.609: E/TiApplication(32009): (main) [348,985] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to create application uk.co.spiritquest.sfl11b1.ScifilondonApplication: android.database.sqlite.SQLiteException: unable to open database file; Titanium 2.0.0,2012/03/30 10:33,b091bae 04-05 15:36:30.609: E/TiApplication(32009): java.lang.RuntimeException: Unable to create application uk.co.spiritquest.sfl11b1.ScifilondonApplication: android.database.sqlite.SQLiteException: unable to open database file 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3812) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.access$2200(ActivityThread.java:132) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1082) 04-05 15:36:30.609: E/TiApplication(32009): at android.os.Handler.dispatchMessage(Handler.java:99) 04-05 15:36:30.609: E/TiApplication(32009): at android.os.Looper.loop(Looper.java:150) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.main(ActivityThread.java:4277) 04-05 15:36:30.609: E/TiApplication(32009): at java.lang.reflect.Method.invokeNative(Native Method) 04-05 15:36:30.609: E/TiApplication(32009): at java.lang.reflect.Method.invoke(Method.java:507) 04-05 15:36:30.609: E/TiApplication(32009): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 04-05 15:36:30.609: E/TiApplication(32009): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 04-05 15:36:30.609: E/TiApplication(32009): at dalvik.system.NativeStart.main(Native Method) 04-05 15:36:30.609: E/TiApplication(32009): Caused by: android.database.sqlite.SQLiteException: unable to open database file 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteDatabase.dbopen(Native Method) 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1956) 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:902) 04-05 15:36:30.609: E/TiApplication(32009): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:208) 04-05 15:36:30.609: E/TiApplication(32009): at org.appcelerator.titanium.util.TiDatabaseHelper.getPlatformParam(TiDatabaseHelper.java:73) 04-05 15:36:30.609: E/TiApplication(32009): at org.appcelerator.titanium.util.TiPlatformHelper.initialize(TiPlatformHelper.java:69) 04-05 15:36:30.609: E/TiApplication(32009): at org.appcelerator.titanium.TiApplication.postAppInfo(TiApplication.java:349) 04-05 15:36:30.609: E/TiApplication(32009): at uk.co.spiritquest.sfl11b1.ScifilondonApplication.onCreate(ScifilondonApplication.java:34) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:984) 04-05 15:36:30.609: E/TiApplication(32009): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3809) 04-05 15:36:30.609: E/TiApplication(32009): ... 10 more {code} h4. Expected results the DB working fine h4. Test Case 1. Create New mobile project 2. Add this code: {code} var win = Ti.UI.createWindow(); var l = Titanium.UI.createLabel({ text:'See Log for output', top:10, left:10, height:'auto', width:'auto' }); win.add(l); var b1 = Titanium.UI.createButton({ title:'DB in 2nd Context', width:200, height:40, top:40 }); win.add(b1); b1.addEventListener('click', function() { var win1 = Titanium.UI.createWindow({ url:'database_2.js', height:30, width:280, borderRadius:10, bottom:80, backgroundColor:'#333' }); var l1 = Titanium.UI.createLabel({ text:'2nd context test - see log.', color:'#fff', font:{fontSize:14}, width:'auto', height:'auto' }); win1.add(l1); win1.open(); }); var b2 = Titanium.UI.createButton({ title:'Pre-packaged DB', width:200, height:40, top:100 }); win.add(b2); b2.addEventListener('click', function() { var win2 = Titanium.UI.createWindow({ url:'database_3.js', height:30, width:280, borderRadius:10, bottom:140, backgroundColor:'#333' }); var l2= Titanium.UI.createLabel({ text:'Pre-packaged Db - see log.', color:'#fff', font:{fontSize:14}, width:'auto', height:'auto' }); win2.add(l2); win2.open(); }); var l3 = Titanium.UI.createLabel({ text:'unicode placeholder', width:300, height:40, top:190 }); win.add(l3); if (Ti.Platform.osname !== 'android') { win.add(l3); var b3 = Titanium.UI.createButton({ title:'Check DB FullPath', width:200, height:40, top:150 }); b3.addEventListener('click', function() { var path = db.file; alert("mysql.db fullpath : \n \nType :" + path +"\n\nFullPath: "+path.nativePath); }); win.add(b3); } var db = Titanium.Database.open('mydb'); db.execute('CREATE TABLE IF NOT EXISTS DATABASETEST (ID INTEGER, NAME TEXT)'); db.execute('DELETE FROM DATABASETEST'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',1,'Name 1'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',2,'Name 2'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',3,'Name 3'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',4,'Name 4'); db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)', 5, '\u2070 \u00B9 \u00B2 \u00B3 \u2074 \u2075 \u2076 \u2077 \u2078 \u2079'); var updateName = 'I was updated'; var updateId = 4; db.execute('UPDATE DATABASETEST SET NAME = ? WHERE ID = ?', updateName, updateId); db.execute('UPDATE DATABASETEST SET NAME = "I was updated too" WHERE ID = 2'); db.execute('DELETE FROM DATABASETEST WHERE ID = ?',1); Titanium.API.info('JUST INSERTED, rowsAffected = ' + db.rowsAffected); Titanium.API.info('JUST INSERTED, lastInsertRowId = ' + db.lastInsertRowId); var rows = db.execute('SELECT * FROM DATABASETEST'); Titanium.API.info('ROW COUNT = ' + rows.getRowCount()); Titanium.API.info('ROW COUNT = ' + rows.getRowCount()); Titanium.API.info('ROW COUNT = ' + rows.getRowCount()); while (rows.isValidRow()) { Titanium.API.info('ID: ' + rows.field(0) + ' NAME: ' + rows.fieldByName('name') + ' COLUMN NAME ' + rows.fieldName(0)); if (rows.field(0)==5) { l3.text = rows.fieldByName('name'); } rows.next(); } rows.close(); db.close(); // close db when you're done to save resources win.open(); {code} h4. Extra info Also the Studio Console failed to build prior to the above error: I will have to add that as a comment when i encounter it next.
    via by Ketan Majmudar,
  • cannot open database in android test app
    via Stack Overflow by Dave Springgay
    ,
    • android.database.sqlite.SQLiteException: unable to open database file at android.database.sqlite.SQLiteDatabase.dbopen(Native Method) at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1812) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:817) at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:851) at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:844) at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:540) at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98) at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:158) at com.google.android.apps.analytics.PersistentEventStore.getNumStoredEvents(Unknown Source) at com.google.android.apps.analytics.PersistentEventStore.startNewVisit(Unknown Source) at com.google.android.apps.analytics.GoogleAnalyticsTracker.start(Unknown Source) at com.google.android.apps.analytics.GoogleAnalyticsTracker.start(Unknown Source) at com.google.android.apps.analytics.GoogleAnalyticsTracker.start(Unknown Source) at org.iii.romulus.meridian.core.Utils.startTracker(Utils.java:440) at org.iii.romulus.meridian.IndexActivity.onCreate(IndexActivity.java:82) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503) at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127) at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339) at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651) at android.widget.TabHost.setCurrentTab(TabHost.java:323) at android.widget.TabHost.addTab(TabHost.java:213) at org.iii.romulus.meridian.MainActivity.initViews(MainActivity.java:292) at org.iii.romulus.meridian.MainActivity.onCreate(MainActivity.java:150) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) at android.app.ActivityThread.access$2300(ActivityThread.java:125) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4627) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) at dalvik.system.NativeStart.main(Native Method)

    Users with the same issue

    filpgame
    1 times, last one,
    Unknown visitor1 times, last one,
    Ranjana Dangol
    4 times, last one,
    ivotje50
    6 times, last one,
    brunosatriani
    1 times, last one,
    9 more bugmates