So, I've been relying on the automated (almost) onCreate / onUpgrade my SQLite database for so long. Everything worked fine, and I just had to change the version number of the database so that it automatically started onUpgrade .
But now I came across this exception when trying to add a column to my database and changing the version number:
SQLiteException: Can't upgrade read-only database from version X to Y
Looking at my code, I am sure that the first query of my application is a SELECT query, and I use getReadableDatabase to open a connection for it because the query does not require write access.
So, I was wondering, how can I solve such a problem? Should I use getWritableDatabase all the time? (as a workaround that works to pass my update). Of course, if both methods exist because they are designed to be used and the connection is optimized for read-only access when necessary? I would not want to lose profit.
Guillaume
source share