SQLite Database 0.9r OpenOrCreateDatabase

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

SQLite Database 0.9r OpenOrCreateDatabase

Postby d0gma » Mon Sep 01, 2008 1:04 pm

Hello there,

Just installed the new 0.9r and I have a bit of a problem with my Database.

This is my code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4. public class NewsDatabase {
  5.  
  6.  
  7.  
  8.         private static final String CREATE_TABLE_SITES = "create table sites (site_id integer primary key autoincrement, "
  9.  
  10.                     + "title text not null, url text not null);";
  11.  
  12.         private static final String CREATE_TABLE_NEWS = "create table news (news_id integer primary key autoincrement, "
  13.  
  14.                     + "site_id int not null, title text not null, url text not null, data text not null);";
  15.  
  16.  
  17.  
  18.         private static final String SITES_TABLE = "sites";
  19.  
  20.         private static final String NEWS_TABLE = "news";
  21.  
  22.         private static final String DATABASE_NAME = "iNewspaper";
  23.  
  24.         private static final int DATABASE_VERSION = 1;
  25.  
  26.        
  27.  
  28.         private static final String TAG = "NewsDatabase";
  29.  
  30.        
  31.  
  32.         private SQLiteDatabase db;
  33.  
  34.        
  35.  
  36.         public NewsDatabase(Context ctx){
  37.  
  38.         try {
  39.  
  40.                 db = ctx.openDatabase(DATABASE_NAME, null);
  41.  
  42.         } catch (FileNotFoundException e) {
  43.  
  44.                         try {
  45.  
  46.                                 db = ctx.createDatabase(DATABASE_NAME, DATABASE_VERSION, 0, null);
  47.  
  48.                     db.execSQL(CREATE_TABLE_SITES);
  49.  
  50.                     db.execSQL(CREATE_TABLE_NEWS);
  51.  
  52.                         } catch (FileNotFoundException  e1) { db = null;}
  53.  
  54.                 }
  55.  
  56.         }      
  57.  
  58.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


So apparently db = ctx.openDatabase(DATABASE_NAME, null);
Does not work any more and has been changed to OpenOrCreateDatabase.
As well as db = ctx.createDatabase(DATABASE_NAME, DATABASE_VERSION, 0, null);
But how can you distinguish the both.
First open and then if not created create with the given SQL.

I do not want to use SqliteOpenHelper cause all of my methods and such are already done.
I just would like to know HOW can you open/create a SQLite db in the new release 0.9.

Thanks for your help!

Cheers
d0gma
Freshman
Freshman
 
Posts: 3
Joined: Mon Aug 18, 2008 9:50 am

Top

Postby living_sword » Tue Sep 02, 2008 4:29 pm

your NewsDatabase class should look like this,


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public NewsDatabase(Context ctx)
  3.  
  4. {
  5.  
  6.      
  7.  
  8.           db = ctx.openOrCreateDatabase(DATABASE_NAME, MODE_WORLD_WRITABLE, null);
  9.  
  10.           db.execSQL(CREATE_TABLE_SITES);
  11.  
  12.           db.execSQL(CREATE_TABLE_NEWS);
  13.  
  14.              
  15.  
  16. }
  17.  
  18.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4



and modify the String CREATE_TABLE_SITES to "CREATE TABLE IF NOT EXISTS SITES....." , do same for CREATE_TABLE_NEWS. This way if the database is opened, the tables will not be created again.
Image
living_sword
Junior Developer
Junior Developer
 
Posts: 23
Joined: Fri Nov 23, 2007 4:44 am

Postby d0gma » Wed Sep 03, 2008 10:03 am

Thanks!

I had that one already.
It looks like my problem is the emulator and something wrong there.
My app works fine on another computer.

Even if I build a hello android app I get in the LogCat this:
Re downloading and re installing And/Eclipse does not help.


Code: Select all
09-03 08:57:27.661: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'BEGIN EXCLUSIVE;'
09-03 08:57:27.661: ERROR/Database(52): Error executing BEGIN EXCLUSIVE;
09-03 08:57:27.701: ERROR/DatabaseUtils(52): Writing exception to parcel
09-03 08:57:27.701: ERROR/DatabaseUtils(52): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1336)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:342)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteCursor.commitUpdates(SQLiteCursor.java:284)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.database.AbstractCursor.commitUpdates(AbstractCursor.java:436)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.server.checkin.CheckinProvider.insertStats(CheckinProvider.java:262)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:159)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:124)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at android.os.Binder.execTransact(Binder.java:276)
09-03 08:57:27.701: ERROR/DatabaseUtils(52):     at dalvik.system.NativeStart.run(Native Method)
09-03 08:57:27.751: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'BEGIN EXCLUSIVE;'
09-03 08:57:27.751: ERROR/Database(52): Error executing BEGIN EXCLUSIVE;
09-03 08:57:27.802: ERROR/Checkin(52): Can't update stat: CRASHES_REPORTED
09-03 08:57:27.802: ERROR/Checkin(52): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:27.802: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1336)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:342)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.database.sqlite.SQLiteCursor.commitUpdates(SQLiteCursor.java:284)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.database.AbstractCursor.commitUpdates(AbstractCursor.java:436)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertStats(CheckinProvider.java:262)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:159)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.provider.Checkin.updateStats(Checkin.java:220)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertCrash(CheckinProvider.java:289)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:161)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.provider.Checkin.reportCrash(Checkin.java:240)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.server.checkin.CheckinService.reportCrash(CheckinService.java:241)
09-03 08:57:27.802: ERROR/Checkin(52):     at com.android.internal.os.RuntimeInit.reportException(RuntimeInit.java:367)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.util.Log.e(Log.java:220)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.database.DatabaseUtils.writeExceptionToParcel(DatabaseUtils.java:94)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:200)
09-03 08:57:27.802: ERROR/Checkin(52):     at android.os.Binder.execTransact(Binder.java:276)
09-03 08:57:27.802: ERROR/Checkin(52):     at dalvik.system.NativeStart.run(Native Method)
09-03 08:57:27.802: ERROR/AndroidRuntime(52): Crash logging skipped, already logging another crash
09-03 08:57:27.831: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)'
09-03 08:57:27.831: ERROR/Database(52): Error executing DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:27.831: ERROR/CheckinProvider(52): Error inserting crash: android.database.sqlite.SQLiteException: attempt to write a readonly database: DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:27.851: ERROR/Checkin(90): Can't update stat: PHONE_GSM_REGISTERED
09-03 08:57:27.851: ERROR/Checkin(90): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:27.851: ERROR/Checkin(90):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:143)
09-03 08:57:27.851: ERROR/Checkin(90):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:111)
09-03 08:57:27.851: ERROR/Checkin(90):     at android.content.ContentProviderProxy.insert(ContentProviderNative.java:320)
09-03 08:57:27.851: ERROR/Checkin(90):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:27.851: ERROR/Checkin(90):     at android.provider.Checkin.updateStats(Checkin.java:220)
09-03 08:57:27.851: ERROR/Checkin(90):     at com.android.internal.telephony.gsm.ServiceStateTracker.pollStateDone(ServiceStateTracker.java:760)
09-03 08:57:27.851: ERROR/Checkin(90):     at com.android.internal.telephony.gsm.ServiceStateTracker.handlePollStateResult(ServiceStateTracker.java:609)
09-03 08:57:27.851: ERROR/Checkin(90):     at com.android.internal.telephony.gsm.ServiceStateTracker.handleMessage(ServiceStateTracker.java:411)
09-03 08:57:27.851: ERROR/Checkin(90):     at android.os.Handler.dispatchMessage(Handler.java:88)
09-03 08:57:27.851: ERROR/Checkin(90):     at android.os.Looper.loop(Looper.java:123)
09-03 08:57:27.851: ERROR/Checkin(90):     at android.app.ActivityThread.main(ActivityThread.java:3708)
09-03 08:57:27.851: ERROR/Checkin(90):     at java.lang.reflect.Method.invokeNative(Native Method)
09-03 08:57:27.851: ERROR/Checkin(90):     at java.lang.reflect.Method.invoke(Method.java:492)
09-03 08:57:27.851: ERROR/Checkin(90):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:734)
09-03 08:57:27.851: ERROR/Checkin(90):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:492)
09-03 08:57:27.851: ERROR/Checkin(90):     at dalvik.system.NativeStart.main(Native Method)
09-03 08:57:27.911: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'BEGIN EXCLUSIVE;'
09-03 08:57:27.911: ERROR/Database(52): Error executing BEGIN EXCLUSIVE;
09-03 08:57:27.941: ERROR/Checkin(52): Can't update stat: CRASHES_REPORTED
09-03 08:57:27.941: ERROR/Checkin(52): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:27.941: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1336)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:342)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.database.sqlite.SQLiteCursor.commitUpdates(SQLiteCursor.java:284)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.database.AbstractCursor.commitUpdates(AbstractCursor.java:436)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertStats(CheckinProvider.java:262)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:159)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.provider.Checkin.updateStats(Checkin.java:220)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertCrash(CheckinProvider.java:289)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:161)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.provider.Checkin.reportCrash(Checkin.java:240)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.server.checkin.CheckinService.reportCrash(CheckinService.java:241)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.os.ICheckinService$Stub.onTransact(ICheckinService.java:58)
09-03 08:57:27.941: ERROR/Checkin(52):     at android.os.Binder.execTransact(Binder.java:276)
09-03 08:57:27.941: ERROR/Checkin(52):     at dalvik.system.NativeStart.run(Native Method)
09-03 08:57:27.971: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'BEGIN EXCLUSIVE;'
09-03 08:57:27.971: ERROR/Database(52): Error executing BEGIN EXCLUSIVE;
09-03 08:57:28.041: ERROR/Checkin(52): Can't update stat: CRASHES_REPORTED
09-03 08:57:28.041: ERROR/Checkin(52): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:28.041: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1336)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:342)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.database.sqlite.SQLiteCursor.commitUpdates(SQLiteCursor.java:284)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.database.AbstractCursor.commitUpdates(AbstractCursor.java:436)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertStats(CheckinProvider.java:262)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:159)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.provider.Checkin.updateStats(Checkin.java:220)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertCrash(CheckinProvider.java:289)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:161)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.provider.Checkin.reportCrash(Checkin.java:240)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinService.reportCrash(CheckinService.java:241)
09-03 08:57:28.041: ERROR/Checkin(52):     at com.android.internal.os.RuntimeInit.reportException(RuntimeInit.java:367)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.util.Log.e(Log.java:220)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.provider.Checkin.updateStats(Checkin.java:222)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertCrash(CheckinProvider.java:289)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:161)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.provider.Checkin.reportCrash(Checkin.java:240)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.server.checkin.CheckinService.reportCrash(CheckinService.java:241)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.os.ICheckinService$Stub.onTransact(ICheckinService.java:58)
09-03 08:57:28.041: ERROR/Checkin(52):     at android.os.Binder.execTransact(Binder.java:276)
09-03 08:57:28.041: ERROR/Checkin(52):     at dalvik.system.NativeStart.run(Native Method)
09-03 08:57:28.041: ERROR/AndroidRuntime(52): Crash logging skipped, already logging another crash
09-03 08:57:28.041: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)'
09-03 08:57:28.041: ERROR/Database(52): Error executing DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:28.041: ERROR/CheckinProvider(52): Error inserting crash: android.database.sqlite.SQLiteException: attempt to write a readonly database: DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:28.041: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)'
09-03 08:57:28.041: ERROR/Database(52): Error executing DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:28.041: ERROR/CheckinProvider(52): Error inserting crash: android.database.sqlite.SQLiteException: attempt to write a readonly database: DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:28.241: INFO/ActivityManager(52): Starting activity: Intent { flags=0x10000000 comp={com.android.hello/com.android.hello.HelloAndroid} }
09-03 08:57:28.421: DEBUG/AndroidRuntime(149): Shutting down VM
09-03 08:57:28.421: DEBUG/dalvikvm(149): DestroyJavaVM waiting for non-daemon threads to exit
09-03 08:57:28.421: INFO/ActivityManager(52): Start proc com.android.mms for broadcast com.android.mms/.transaction.SmsReceiver: pid=161 uid=10014 gids={3003}
09-03 08:57:28.431: INFO/dalvikvm(149): DestroyJavaVM shutting VM down
09-03 08:57:28.431: DEBUG/dalvikvm(149): HeapWorker thread shutting down
09-03 08:57:28.431: DEBUG/dalvikvm(149): HeapWorker thread has shut down
09-03 08:57:28.431: DEBUG/jdwp(149): JDWP shutting down net...
09-03 08:57:28.441: DEBUG/dalvikvm(149): VM cleaning up
09-03 08:57:28.451: DEBUG/dalvikvm(149): LinearAlloc 0x0 used 536572 of 4194304 (12%)
09-03 08:57:28.551: INFO/jdwp(123): received file descriptor 29 from ADB
09-03 08:57:28.661: INFO/jdwp(161): received file descriptor 13 from ADB
09-03 08:57:28.761: INFO/ActivityManager(52): Start proc com.android.hello for activity com.android.hello/.HelloAndroid: pid=169 uid=10015 gids={}
09-03 08:57:28.831: INFO/jdwp(169): received file descriptor 10 from ADB
09-03 08:57:29.031: DEBUG/PhoneApp(90): [CallNotifier] onMwiChanged(): false
09-03 08:57:29.071: DEBUG/PhoneApp(90): [CallNotifier] onCfiChanged(): false
09-03 08:57:29.351: WARN/StkAppInstaller(90): Could not change STK app state
09-03 08:57:29.411: DEBUG/TelephonyProvider(90): Setting numeric '310995' to be the current operator
09-03 08:57:29.541: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'BEGIN EXCLUSIVE;'
09-03 08:57:29.581: ERROR/Database(52): Error executing BEGIN EXCLUSIVE;
09-03 08:57:29.581: ERROR/DatabaseUtils(52): Writing exception to parcel
09-03 08:57:29.581: ERROR/DatabaseUtils(52): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1336)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:342)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.database.sqlite.SQLiteCursor.commitUpdates(SQLiteCursor.java:284)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.database.AbstractCursor.commitUpdates(AbstractCursor.java:436)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.server.checkin.CheckinProvider.insertStats(CheckinProvider.java:262)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:159)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:124)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at android.os.Binder.execTransact(Binder.java:276)
09-03 08:57:29.581: ERROR/DatabaseUtils(52):     at dalvik.system.NativeStart.run(Native Method)
09-03 08:57:29.601: VERBOSE/SQLite(169): myeskuel error
09-03 08:57:29.641: ERROR/Database(169): sqlite3_open_v2("/data/data/com.android.hello/databases/iNewspaper", &handle, 6, NULL) failed
09-03 08:57:29.651: DEBUG/AndroidRuntime(169): Shutting down VM
09-03 08:57:29.651: WARN/dalvikvm(169): threadid=3: thread exiting with uncaught exception (group=0x40010e28)
09-03 08:57:29.651: ERROR/AndroidRuntime(169): Uncaught handler: thread main exiting due to uncaught exception
09-03 08:57:29.671: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'BEGIN EXCLUSIVE;'
09-03 08:57:29.671: ERROR/Database(52): Error executing BEGIN EXCLUSIVE;
09-03 08:57:29.691: DEBUG/dalvikvm(94): GC freed 2661 objects / 122656 bytes in 263ms
09-03 08:57:29.731: ERROR/Checkin(52): Can't update stat: CRASHES_REPORTED
09-03 08:57:29.731: ERROR/Checkin(52): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:29.731: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1336)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:342)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.database.sqlite.SQLiteCursor.commitUpdates(SQLiteCursor.java:284)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.database.AbstractCursor.commitUpdates(AbstractCursor.java:436)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertStats(CheckinProvider.java:262)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:159)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.provider.Checkin.updateStats(Checkin.java:220)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertCrash(CheckinProvider.java:289)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:161)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.provider.Checkin.reportCrash(Checkin.java:240)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.server.checkin.CheckinService.reportCrash(CheckinService.java:241)
09-03 08:57:29.731: ERROR/Checkin(52):     at com.android.internal.os.RuntimeInit.reportException(RuntimeInit.java:367)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.util.Log.e(Log.java:220)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.database.DatabaseUtils.writeExceptionToParcel(DatabaseUtils.java:94)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:200)
09-03 08:57:29.731: ERROR/Checkin(52):     at android.os.Binder.execTransact(Binder.java:276)
09-03 08:57:29.731: ERROR/Checkin(52):     at dalvik.system.NativeStart.run(Native Method)
09-03 08:57:29.751: ERROR/AndroidRuntime(169): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.hello/com.android.hello.HelloAndroid}: android.database.sqlite.SQLiteException: unable to open database file
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2131)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2147)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1572)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.os.Handler.dispatchMessage(Handler.java:88)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.os.Looper.loop(Looper.java:123)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.ActivityThread.main(ActivityThread.java:3708)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at java.lang.reflect.Method.invokeNative(Native Method)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at java.lang.reflect.Method.invoke(Method.java:492)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:734)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:492)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at dalvik.system.NativeStart.main(Native Method)
09-03 08:57:29.751: ERROR/AndroidRuntime(169): Caused by: android.database.sqlite.SQLiteException: unable to open database file
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1421)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:536)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:557)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:550)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:419)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:181)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at com.android.hello.SQLite.<init>(SQLite.java:27)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at com.android.hello.HelloAndroid.onCreate(HelloAndroid.java:48)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1121)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2094)
09-03 08:57:29.751: ERROR/AndroidRuntime(169):     ... 11 more
09-03 08:57:29.751: ERROR/AndroidRuntime(52): Crash logging skipped, already logging another crash
09-03 08:57:29.751: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)'
09-03 08:57:29.751: ERROR/Database(52): Error executing DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:29.751: ERROR/CheckinProvider(52): Error inserting crash: android.database.sqlite.SQLiteException: attempt to write a readonly database: DELETE FROM crashes WHERE _id IN (SELECT _id FROM crashes ORDER BY _id DESC LIMIT -1 OFFSET 24)
09-03 08:57:29.791: INFO/Process(52): Sending signal. PID: 169 SIG: 3
09-03 08:57:29.801: ERROR/Checkin(90): Can't update stat: PHONE_GPRS_ATTEMPTED
09-03 08:57:29.801: ERROR/Checkin(90): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:29.801: ERROR/Checkin(90):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:143)
09-03 08:57:29.801: ERROR/Checkin(90):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:111)
09-03 08:57:29.801: ERROR/Checkin(90):     at android.content.ContentProviderProxy.insert(ContentProviderNative.java:320)
09-03 08:57:29.801: ERROR/Checkin(90):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:29.801: ERROR/Checkin(90):     at android.provider.Checkin.updateStats(Checkin.java:220)
09-03 08:57:29.801: ERROR/Checkin(90):     at com.android.internal.telephony.gsm.DataConnectionTracker.setState(DataConnectionTracker.java:304)
09-03 08:57:29.801: ERROR/Checkin(90):     at com.android.internal.telephony.gsm.DataConnectionTracker.setupData(DataConnectionTracker.java:706)
09-03 08:57:29.801: ERROR/Checkin(90):     at com.android.internal.telephony.gsm.DataConnectionTracker.trySetupData(DataConnectionTracker.java:600)
09-03 08:57:29.801: ERROR/Checkin(90):     at com.android.internal.telephony.gsm.DataConnectionTracker.handleMessage(DataConnectionTracker.java:1066)
09-03 08:57:29.801: ERROR/Checkin(90):     at android.os.Handler.dispatchMessage(Handler.java:88)
09-03 08:57:29.801: ERROR/Checkin(90):     at android.os.Looper.loop(Looper.java:123)
09-03 08:57:29.801: ERROR/Checkin(90):     at android.app.ActivityThread.main(ActivityThread.java:3708)
09-03 08:57:29.801: ERROR/Checkin(90):     at java.lang.reflect.Method.invokeNative(Native Method)
09-03 08:57:29.801: ERROR/Checkin(90):     at java.lang.reflect.Method.invoke(Method.java:492)
09-03 08:57:29.801: ERROR/Checkin(90):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:734)
09-03 08:57:29.801: ERROR/Checkin(90):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:492)
09-03 08:57:29.801: ERROR/Checkin(90):     at dalvik.system.NativeStart.main(Native Method)
09-03 08:57:29.821: INFO/dalvikvm(169): threadid=7: reacting to signal 3
09-03 08:57:29.881: INFO/dalvikvm(169): Wrote stack trace to '/data/anr/traces.txt'
09-03 08:57:29.921: ERROR/Database(52): Failure 8 (attempt to write a readonly database) on 0x23c418 when executing 'BEGIN EXCLUSIVE;'
09-03 08:57:29.941: ERROR/Database(52): Error executing BEGIN EXCLUSIVE;
09-03 08:57:29.961: ERROR/Checkin(52): Can't update stat: CRASHES_REPORTED
09-03 08:57:29.961: ERROR/Checkin(52): android.database.sqlite.SQLiteException: attempt to write a readonly database: BEGIN EXCLUSIVE;
09-03 08:57:29.961: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1336)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:342)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.database.sqlite.SQLiteCursor.commitUpdates(SQLiteCursor.java:284)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.database.AbstractCursor.commitUpdates(AbstractCursor.java:436)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertStats(CheckinProvider.java:262)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:159)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.provider.Checkin.updateStats(Checkin.java:220)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insertCrash(CheckinProvider.java:289)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.server.checkin.CheckinProvider.insert(CheckinProvider.java:161)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.content.ContentResolver.insert(ContentResolver.java:335)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.provider.Checkin.reportCrash(Checkin.java:240)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.server.checkin.CheckinService.reportCrash(CheckinService.java:241)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.os.ICheckinService$Stub.onTransact(ICheckinService.java:58)
09-03 08:57:29.961: ERROR/Checkin(52):     at android.os.Binder.execTransact(Binder.java:276)
09-03 08:57:29.961: ERROR/Checkin(52):     at dalvik.system.NativeStart.run(Native Method)
d0gma
Freshman
Freshman
 
Posts: 3
Joined: Mon Aug 18, 2008 9:50 am

Postby plusminus » Tue Sep 09, 2008 9:21 pm

Maybe run your emulator with the "-wipe-data" option, once.
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby kolch9 » Fri Jun 26, 2009 4:29 pm

d0gma can i ask you to post how you save the data in the two tables???because i've problems to do that..i can manipulate the first table without problems,but i can't save data in the second..thanks!!!!!

stefano
kolch9
Junior Developer
Junior Developer
 
Posts: 11
Joined: Wed Feb 18, 2009 2:17 pm

Postby Vj » Wed Jul 29, 2009 8:58 pm

plusminus wrote:Maybe run your emulator with the "-wipe-data" option, once.


Yep. That worked for me.
Vj
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Jul 29, 2009 8:56 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests