support create sqlite3 database? #1948
-
Hi, I build android apk with briefcase, and in the code will create sqlite3 database, but when run the apk, it will fail as follows, so it doesn't support create database yet? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There should be no problem reading, writing or creating SQLite databases - provided you name a file location that is writable. On Android, the current working directory isn't writable; if you specify a filename without a fully qualified path, it will be interpreted relative to the current working directory, which will cause errors. If you're using Toga, the app object has a |
Beta Was this translation helpful? Give feedback.
There should be no problem reading, writing or creating SQLite databases - provided you name a file location that is writable.
On Android, the current working directory isn't writable; if you specify a filename without a fully qualified path, it will be interpreted relative to the current working directory, which will cause errors.
If you're using Toga, the app object has a
paths
attribute that contains a collection of base paths you can use to build a writable filename (egself.paths.data / "my.db"
in your startup method will describe a database file in the user's "data" folder. You may need to create that folder first with mkdir; but once it exists, the file will be writable.