Android Question sql error

StarinschiAndrei

Active Member
Licensed User
Longtime User
Hi everyone,
I'm facing with the following situation:
i have 2 test environment; 1 - Samsung A71 - Android 13 and Xiomi Mi6 with Android 9.
if a run the app on Samsung is working on Xiomi I get an SQL error
B4X:
pg_sell_new_load_items (java line: 674)
android.database.sqlite.SQLiteException: no such table: tbl_items (code 1 SQLITE_ERROR): , while compiling: Select * FROM tbl_items WHERE Activ=1 order by Nume ASC
Can anybody advice me what shod i do or try ?
Thank you.
 
Last edited:

josejad

Expert
Licensed User
Longtime User
Can anybody advice me what shod i do or try ?
It‘s difficult without watching your code or a project showing the problem. We just can guess
Have you updated your sqlite database or have you created the table by code?
Can you open both db with some db manager to check if the table is there?
 
Upvote 0

StarinschiAndrei

Active Member
Licensed User
Longtime User
Hi everyone,
I'm facing with the following situation:
i have 2 test environment; 1 - Samsung A71 - Android 13 and Xiomi Mi6 with Android 9.
if a run the app on Samsung is working on Xiomi I get an SQL error
B4X:
pg_sell_new_load_items (java line: 674)
android.database.sqlite.SQLiteException: no such table: tbl_items (code 1 SQLITE_ERROR): , while compiling: Select * FROM tbl_items WHERE Activ=1 order by Nume ASC
Can anybody advice me what shod i do or try ?
Thank you.
Thank you for your answer , attached you can find the test project
 

Attachments

  • AS MultiColumnCustomListView.zip
    439.7 KB · Views: 52
Upvote 0

PaulMeuris

Active Member
Licensed User
Caused by: android.database.sqlite.SQLiteException: no such table: tbl_items (code 1): , while compiling: Select * from tbl_items order by Nume ASC
#################################################################
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database.
(no such table: tbl_items (code 1): , while compiling: Select * from tbl_items order by Nume ASC)
#################################################################
The first thing you should do is add the tbl_items table to the pos.db database...
The pos.db file can't be opened with a database tool.
 
Upvote 0

geps

Member
Licensed User
Longtime User
Make sure that the database schema is being properly created and migrated on both devices. You could also try updating the app or reinstalling it to see if that resolves the issue.
 
Upvote 0

StarinschiAndrei

Active Member
Licensed User
Longtime User
Thank you for everybody support , i made some tests and i think the problem is with permission on Xiomi , the db file is on device (attached image), but app can't access the db , here
B4X:
    SQL1.Initialize(xui.DefaultFolder, "pos.db",False)
i get the error. On Samsung it works perfect.
B4X:
** Service (starter) Start **
** Activity (main) Create (first time) **
true
Error occurred on line: 39 (B4XMainPage)
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14 SQLITE_CANTOPEN): Could not open database
    at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:211)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:195)
    at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:503)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:204)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:196)
    at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:880)
    at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:868)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:766)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:714)
    at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
    at com.stoltex.MultiColumnCustomListView.b4xmainpage._b4xpage_created(b4xmainpage.java:72)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1087)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1071)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._showpage(b4xpagesmanager.java:428)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._addpage(b4xpagesmanager.java:248)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:262)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._initialize(b4xpagesmanager.java:168)
    at com.stoltex.MultiColumnCustomListView.main._activity_create(main.java:419)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at com.stoltex.MultiColumnCustomListView.main.afterFirstLayout(main.java:105)

true.png
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Thank you for everybody support , i made some tests and i think the problem is with permission on Xiomi , the db file is on device (attached image), but app can't access the db , here
B4X:
    SQL1.Initialize(xui.DefaultFolder, "pos.db",False)
i get the error. On Samsung it works perfect.
B4X:
** Service (starter) Start **
** Activity (main) Create (first time) **
true
Error occurred on line: 39 (B4XMainPage)
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14 SQLITE_CANTOPEN): Could not open database
    at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:211)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:195)
    at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:503)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:204)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:196)
    at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:880)
    at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:868)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:766)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:714)
    at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
    at com.stoltex.MultiColumnCustomListView.b4xmainpage._b4xpage_created(b4xmainpage.java:72)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1087)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1071)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._showpage(b4xpagesmanager.java:428)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._addpage(b4xpagesmanager.java:248)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:262)
    at com.stoltex.MultiColumnCustomListView.b4xpagesmanager._initialize(b4xpagesmanager.java:168)
    at com.stoltex.MultiColumnCustomListView.main._activity_create(main.java:419)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at com.stoltex.MultiColumnCustomListView.main.afterFirstLayout(main.java:105)

View attachment 156037
Have you uninstalled the app first after you made changes to the code I suggested?
 
Upvote 0

StarinschiAndrei

Active Member
Licensed User
Longtime User
Have you uninstalled the app first after you made changes to the code I suggested?
Hello Aeric,
After each modification i uninstalled the app on the phone , and only after that a try the new "version" , all the time i receive the same message error (it happen only on Xiomi Mi6) .
 
Upvote 0
Top