Android Question B4A gives Sqlliteexception: No such table xxx exists despite the table being present

beelze69

Active Member
Licensed User
Longtime User
Hi,

I am gettring the error No such Table Exists despite the table being present in the sqllitedb. I have executed the same query using DBrowser for Sqllite and it is giving me the correct output. I even tried to remove the db from the b4A ile manager and reattach the db file again. It may be noted that this particular db has other tables, queries of which are executing properly in b4A.
The problem is only with this particular table which I newly added into this db.
What could be the issue ?

Attaching the log..

Ps. help.
Thanks
B4X:
Logger connected to: SH2AWW504630
--------- beginning of /dev/log/system--------- beginning of /dev/log/main~i:*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Current page: 1
Current page: 2
main_executehtml (java line: 895)
android.database.sqlite.SQLiteException: no such table: TBL_TEST: , while compiling: SELECT DETAILED_VALUE FROM TBL_TEST WHERE I_CODE=38089113
    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:150)
    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:368)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:134)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:98)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:58)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1691)
    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1665)
    at anywheresoftware.b4a.sql.SQL.ExecQuery2(SQL.java:223)
    at anywheresoftware.b4a.sql.SQL.ExecQuery(SQL.java:211)
    at igr.RMDAppNew.main._executehtml(main.java:895)
    at igr.RMDAppNew.main._btnviewccr_click(main.java:876)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:3538)
    at android.view.View$PerformClick.run(View.java:14330)
    at android.os.Handler.handleCallback(Handler.java:608)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:4987)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)
android.database.sqlite.SQLiteException: no such table: TBL_TEST: , while compiling: SELECT DETAILED_VALUE FROM TBL_TEST WHERE I_CODE=38089113
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Ignoring event: ime_heightchanged
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Current page: 1
Current page: 2
main_executehtml (java line: 895)
android.database.sqlite.SQLiteException: no such table: TBL_TEST: , while compiling: SELECT DETAILED_VALUE FROM TBL_TEST WHERE I_CODE=38089113
    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:150)
    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:368)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:134)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:98)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:58)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1691)
    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1665)
    at anywheresoftware.b4a.sql.SQL.ExecQuery2(SQL.java:223)
    at anywheresoftware.b4a.sql.SQL.ExecQuery(SQL.java:211)
    at igr.RMDAppNew.main._executehtml(main.java:895)
    at igr.RMDAppNew.main._btnviewccr_click(main.java:876)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:3538)
    at android.view.View$PerformClick.run(View.java:14330)
    at android.os.Handler.handleCallback(Handler.java:608)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:4987)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)
android.database.sqlite.SQLiteException: no such table: TBL_TEST: , while compiling: SELECT DETAILED_VALUE FROM TBL_TEST WHERE I_CODE=38089113
 

DonManfred

Expert
Licensed User
Longtime User
The problem is only with this particular table which I newly added into this db.
but the db copied to another folder and used in your app is not the DB you lastly added to the files folder.

You need to do the changes you did in the database on your database already in use on the device. Means you need to call the alter table, create table commands on this Database too. Like you did in the new db you want to use.

Or remove them, copy it new from assets and then use it.
 
Upvote 0

beelze69

Active Member
Licensed User
Longtime User


Hi !

Thanks.. The issue was that I was directly compiling onto my mobile and the mobile and the b4A IDE does not overwrite the old database on my mobile with the new one. I uninstalled the application from my mobile and again recompiled it and the problem was solved.

My question:

When we choose 'Compile & Run' from B4A ide why the new database does not get overwritten on the mobile ? Why is it that I have to UNINSTALL the application from my mobile to delete that database ?

Thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…