I'm trying to read a .db file with SQlite. I am using android 11 and the new file handling system. I have already made the request for permissions for the specific folder and they work fine since I can read and write in other .txt files but in the .db I can't.
if (dbFile.exists() && !dbFile.isDirectory()) {
dbSQLite = SQLiteDatabase.openDatabase(dbFile.getUri().getPath(), null, SQLiteDatabase.OPEN_READONLY);
}
when dbFile.getUri().getPath() -> /tree/primary:dia/document/primary:dia/in/catalog.db and file exist.
The call to open the database throws me an exception that I catch:
Method threw 'android.database.sqlite.SQLiteCantOpenDatabaseException' exception.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14 SQLITE_CANTOPEN): Could not open database
Cannot open database '/tree/primary:dia/document/primary:dia/in/catalog.db': Directory /tree/primary:dia/document/primary:dia/in doesn't exist
Thank you very much for your time and sorry for my English