Android Question SQL Database Update Issue


Active Member
Licensed User

So i add a table to my database. I delete the copy from file folders. Put the new copy same name in it.

Then i run my program and it does not recorgnize the new table that was created

Kind of night

** Activity (abbyfull) Pause, UserClosed = true **
** Activity (trivia) Create, isFirst = false **
** Activity (trivia) Resume **
** Activity (trivia) Pause, UserClosed = true **
** Activity (bents1) Create, isFirst = true **
** Activity (bents1) Resume **
bents1_episode1_click (java line: 1362)
android.database.sqlite.SQLiteException: no such table: Bent (code 1): , while compiling: SELECT * FROM Bent Where Episode='1'
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(
    at android.database.sqlite.SQLiteConnection.prepare(
    at android.database.sqlite.SQLiteSession.prepare(
    at android.database.sqlite.SQLiteProgram.<init>(
    at android.database.sqlite.SQLiteQuery.<init>(
    at android.database.sqlite.SQLiteDirectCursorDriver.query(
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(
    at android.database.sqlite.SQLiteDatabase.rawQuery(
    at anywheresoftware.b4a.sql.SQL.ExecQuery2(
    at anywheresoftware.b4a.sql.SQL.ExecQuery(
    at bw.ultimatefreetvtrivia.bents1._episode1_click(
    at bw.ultimatefreetvtrivia.bents1._button1_click(
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(
    at anywheresoftware.b4a.BA.raiseEvent2(
    at anywheresoftware.b4a.BA.raiseEvent(
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(
    at android.view.View.performClick(
    at android.view.View$
    at android.os.Handler.handleCallback(
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invoke(Native Method)
Checked the database and the table is their like every other table i have for shows

Only way i have found for a work around is to rename the databse. Which i really dont want to do for every monthly update

any ideas?

Same issue on emulators and phones/tablets. Testing in release mode


Active Member
Licensed User
The new database will not be updated automatically on your phone, I believe its an external database... which means you will have to recopy it to the phones storage before you can be able to access the new tables.

EDIT: You have to device a way of pushing new database update to your users - one way is tracking your database version.
Example if the old Database is 1 and the updated database is 2, then you know whether you have to copy the new one.


Active Member
Licensed User
What if you add a new table into existing database on your phone?
Dim SQL1 As SQLCipher

Dim tblSymptoms As String

    tblSymptoms="CREATE TABLE  IF NOT EXISTS tblSymptoms ( "
    tblSymptoms=tblSymptoms & "ID INTEGER Not Null PRIMARY KEY AUTOINCREMENT, "
    tblSymptoms=tblSymptoms & "SymptomID INTEGER , "
    tblSymptoms=tblSymptoms & "Symptom Text "   
    tblSymptoms=tblSymptoms & ");"
SQL1.Initialize(DBFileDir, DBFileName, True,PWD,"")

In this case you don't need to copy a database every time you do the update.


Active Member
Licensed User
I greatly appreciate the replies. I should clarify one aspect.

This is a trivia based app. I do monthly updates to add content. Shows/Questions.


Well-Known Member
Licensed User
If the table structure does not change and what you really need is update the records then why not just delete all the records and insert the new records?


Licensed User
any ideas?
remember that you need to copy the database from Filesfolder (Assets) to another place to use it.
Did you overwrite the database on the device with the new one?

Also remember that you should do the changes (new table, new fields) by code with a already existent database on the device to not loose the data stored in the DB.