SQLITE file is encrypted or is not a database

女生的网名这么多〃 提交于 2020-01-13 12:06:54

问题


I have a huge problem... I am developing desktop app with SQLite but during copy/paste process I lost a power and process was terminated so base was lost. However, I found a way to recover it but base is encrypted. When I try to open connection using conn.Open(); I get this error. If I try to open it with DB Browser for SQLite it asks me a SQLCipher encryption password so it seams to me that data is lost..

Is there any default password ? Why did this happen and how to prevent it from happening again ? What can I do ?

Thanks in advance.


回答1:


Ok, finally found a solution that works so posting the answer if anybody will have same trouble as I did..

First of all, use good recover software. For repairing the database I found 3 solutions that work without backup :

  1. Open corrupted database using DB Browser an Export Database to SQL. Name it however you want. Then, create new database and import database from SQL.
  2. There is software that repairs corrupted databases. Download one and use it to repair the database.
  3. Download "sqlite3" from sqlite.org and in command line navigate to folder where "sqlite3" is unzipped. Then try to dump the entire database with .dump, and use those commands to create a new database:

    sqlite3 corrupt_table_name.sqlite ".dump" | sqlite3 new.sqlite
    



回答2:


Your database did not become encrypted (this is only one of the two options in the error message).

Your data recovery tool did not recover the correct data; what you have in the file is something else.

You have to restore the database file from the backup.




回答3:


The issue is with sqlcipher version upgrade in my case, Whenever I update my pod it automatically upgrade the sqlcipher and the error occurred.

For a quick fix just manually add the SDK instead of Pod install. And for a proper solution use this link GitHub Solution



来源:https://stackoverflow.com/questions/44161713/sqlite-file-is-encrypted-or-is-not-a-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!