Hello I am developing a basic mobile application using Codenameone and sqllite the problem is when trying to test my application in my phone I noticed that the application has an empty database or it is not connecting to the database while it is working correctly in the computer's emilator. I am using this line to open or create the database:
db=Display.getInstance().openOrCreate("/astrax.db");
This is the exception I am getting:
android.database.sqlite.SQLiteCantopenDatabaseException: unknown error code 1294 SQLITE_CANTOPEN_ENOENT[1294]); could not open database
Here are some screenshots to make the question clearer: [![enter image description here][1]][1][2][2]
Any advice could help, thanks. [1]: https://i.sstatic.net/Xpewr.png [2]: https://i.sstatic.net/YessH.jpg
The database is created locally and is used for debugging under the simulator. Otherwise every change you make to the database during debugging will go to all your users which isn't what you want.
If you want your app to ship with a pre-existing database check out the developer guide database section https://www.codenameone.com/manual/files-storage-networking.html
Specifically look for getDatabasePath()
. You can simulate this in the debugger by deleting the content of your ~/.cn1
directory (which will remove your debug database).