Re: [android-developers] Re: SQLite Open failed

2011-10-03 Thread lbendlin
That is interesting, but why does it only happen in a seemingly random 
fashion? Say, one out of every 1 app launches ? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: SQLite Open failed

2011-10-03 Thread rich friedel
Kinda sounds like a race condition between SQLiteOpenHelper and onCreate... 
maybe?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: SQLite Open failed

2011-04-15 Thread String
I see a handful of these in my Dev Console error logs, but have never had it 
happen somewhere I can chase it down. Here's a typical stack trace:

android.database.sqlite.SQLiteException: unable to open database file
Caused by: 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:1899)
at 
android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:881)
at 
android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:168)

In one of my apps, where I ship a static database in /assets, I was able 
to work around this by catching the exception, deleting the offending .db 
file, then recreating it from my copy in the APK (same as I do on first 
installation). But you can't do that for user data.

In summary, I believe it's a platform bug, but nebulous enough that it's 
hard to create an error report for. :^(

String

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: SQLite Open failed

2011-04-15 Thread lbendlin
I get the occasional crash report that 

android.database.sqlite.SQLiteException: Can't upgrade read-only database 
from version 0 to 1

which is totally bogus and might be in the same league as your issue 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: SQLite Open failed

2011-04-15 Thread Kostya Vasilyev
FWIW, SQLiteOpenHelper treats version 0 as the initial state, where the 
DB exists, but onCreate hasn't been called yet.


getWritableDatabase:

int version = db.getVersion();
if (version != mNewVersion) {
db.beginTransaction();
try {
if (version == 0) {
onCreate(db);
} else {
onUpgrade(db, version, mNewVersion);
}
db.setVersion(mNewVersion);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}

getReadableDatabase:

SQLiteDatabase db = null;
try {
mIsInitializing = true;
String path = mContext.getDatabasePath(mName).getPath();
db = SQLiteDatabase.openDatabase(path, mFactory, 
SQLiteDatabase.OPEN_READONLY);

if (db.getVersion() != mNewVersion) {
throw new SQLiteException(Can't upgrade read-only 
database from version  +
db.getVersion() +  to  + mNewVersion + :  + 
path);

}

onOpen(db);
Log.w(TAG, Opened  + mName +  in read-only mode);
mDatabase = db;
return mDatabase;
} finally {
mIsInitializing = false;
if (db != null  db != mDatabase) db.close();
}


-- Kostya

15.04.2011 17:46, lbendlin ?:

I get the occasional crash report that

android.database.sqlite.SQLiteException: Can't upgrade read-only
database from version 0 to 1

which is totally bogus and might be in the same league as your issue



--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en