Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqfliteDatabaseException DatabaseException(open_failed /var/mobile/Containers/Data/Application/.../Documents/database_name.db) #99

Open
amrLLSE opened this issue Sep 24, 2024 · 6 comments

Comments

@amrLLSE
Copy link

amrLLSE commented Sep 24, 2024

I'm facing this on the latest version
SqfliteDatabaseException DatabaseException(open_failed/var/mobile/Containers/Data/Application/.../Documents/database_name.db)

@davidmartos96
Copy link
Owner

That can happen when you are providing the wrong password to an encrypted database. Are you opening a database bundled in the app assets or are you encrypting a fresh database?

@amrLLSE
Copy link
Author

amrLLSE commented Sep 24, 2024

@davidmartos96 Fresh database, but I'm sure 100% that the password is correct. Now I'm also investigating in this and if I have reached to the root cause I will mention it here. But if you have any other ideas why this may happen just let me know.

@davidmartos96
Copy link
Owner

I would double check if you have sqlcipher correctly installed. You can open a memory database with sqflite without password and then run "PRAGMA cipher_version" on the database. You should see SQLCipher and the version number. If you don't, it means that something is not correctly configured

@amrLLSE
Copy link
Author

amrLLSE commented Sep 24, 2024

@davidmartos96 Actually I have run "PRAGMA cipher_version" and it prints successfully "SQLCipher Version: 4.5.7 community".

@davidmartos96
Copy link
Owner

davidmartos96 commented Sep 24, 2024

In that case I can only think the following:

  • Password is incorrect
  • The database was previously encrypted with SQLCipher 3.x, which is not directly compatible with 4.x

I'd try deleting the file in the device and try fresh with your latest code. Maybe it was previously encrypted with a different password.

You can also check the SQLCipher related tests (in the lib folder) in the example app in the repository

@amrLLSE
Copy link
Author

amrLLSE commented Sep 24, 2024

@davidmartos96 Okay will check, but this plugin is always using 4x version and I didn't use anything else to open the database.

Thanks for you quick replies and support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants