Possibility of using SQLite file for storage of source data

30 views
Skip to first unread message

DogPlanner GSS

unread,
Jun 9, 2026, 10:45:21 AM (6 days ago) Jun 9
to DroidScript
Dear Developers,

We want to use SQLite database for storage of source data, e.g. Spinner lists, factors for different calculations etc. We created the SQLite file with few data tables using PC and SQLiteStudio, wrote all values manually, and copy this file in the app directory where there is another SQLite file created from the program - all work well, data from the SQLite tables load to arrays, and they are used in spinners etc. But when we create .Apk file and launch our app, there isn't SQLite file with these data, and our Spinner lists don't filled in - errors occur.

Could you pls tell us is it possible to do something in this case (using SQLite file, or e.g. another .js or .txt file)? Or is it needed to write all data directly in the program without SQLite or another files?

SQLite file is very convenient to use because of its table representation!

Thank you very much in advance. Have a nice day!

Best regards
Dmitry

Alan Hendry

unread,
Jun 9, 2026, 4:12:55 PM (6 days ago) Jun 9
to DroidScript
HI,
I usually use text or json files.
To be included in the APK your database
needs to be in your app folder.
app.OpenDatabase allows you to specify
a folder and name.
  app.MakeFolder( "/sdcard/db");
  db = app.OpenDatabase( "/sdcard/db/MultiSearch" );
Not sure if it opens db for update, 
In which case you'd need to copy it out
(Perhaps app.ExtractAssets).
Regards, ah



DogPlanner GSS

unread,
Jun 9, 2026, 5:14:31 PM (6 days ago) Jun 9
to DroidScript
Dear Alan,

Thank you very much for your help! We will try it. At this moment there are following lines in our program for reading the database values:

   // Create or open database MyPets
    db_standard = app.OpenDatabase("standards");

    // Open breeds table in DB
    db_standard.ExecuteSql( "CREATE TABLE IF NOT EXISTS breeds_dog (id integer primary key, breed_ru text, breed_en text, min_male text, max_male text, min_female text, max_female text)" );

    // Read data from table
    db_standard.ExecuteSql( "SELECT  * FROM breeds_dog", [], OnBreedsStandardResult, OnError );

But we will try to insert Make folder method. If it will not help we will use txt or JSON files for this task :))

Thank you again!

Best regards
Dmitry

вторник, 9 июня 2026 г. в 23:12:55 UTC+3, hendr...@gmail.com:
Reply all
Reply to author
Forward
0 new messages