要 encrypt an existing unencrypted database 或 to change the password of an encrypted database ,打开数据库,然后使用SQLiteConnection的ChangePassword()函数:
// Opens an unencrypted database
SQLiteConnection cnn = new SQLiteConnection(“Data Source=c:\test.db3”);
cnn.Open();
// Encrypts the database. The connection remains valid and usable afterwards.
cnn.ChangePassword(“mypassword”);
要 decrypt an existing encrypted database 使用 NULL 或 “” 密码调用 ChangePassword() :
// Opens an encrypted database
SQLiteConnection cnn = new SQLiteConnection(“Data Source=c:\test.db3;Password=mypassword”);
cnn.Open();
// Removes the encryption on an encrypted database.
cnn.ChangePassword(null);
要打开现有加密数据库或创建新加密数据库,请在 ConnectionString 中指定密码,如上例所示,或在打开新 SQLiteConnection 之前调用 SetPassword()
Original: https://blog.csdn.net/weixin_42481553/article/details/114864405
Author: 隔壁一枝花
Title: java sqlite 密码保护_密码保护SQLite数据库 . 可能吗?
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/817532/
转载文章受原作者版权保护。转载请注明原作者出处!