使用密码打开Sqlite db文件

时间:2013-12-26 11:50:49

标签: sqlite system.data.sqlite

它让我生气它让我发疯我一直在寻找过去1周的解决方案,我找不到任何东西。我使用visual studio中的System.Data.SQLite成功创建了一个数据库,一切都运行良好,直到我决定使用密码。

string dbPath = AppDomain.CurrentDomain.BaseDirectory;
        databaseCredentials.dbPath = Path.Combine(dbPath, "database.db");
        string connectionString = "Data Source= " + databaseCredentials.dbPath + ";Version=3;Password= " + "test" + ";";

        Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~Dimiourgia Vasis~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
        //databaseCredentials.db = new SQLiteConnection("Data Source=" + databaseCredentials.dbPath);
        databaseCredentials.db = new SQLiteConnection(connectionString);
        databaseCredentials.db.Open();

如您所见,我设置了密码“test”。该程序可以正常使用db.open()db是可读的,我正常看到表。

当我想从sqlite3 shell读取db文件时,它说:错误:文件已加密或不是数据库,这是我预期会发生的,因为它现在受到保护。

这是我的主要问题。我如何现在从shell打开db文件,以便我可以使用sql命令处理它,以防我想...?我在哪里把密码“test”设置在上面?

1 个答案:

答案 0 :(得分:1)

SQLite本身不支持加密。

System.Data.SQLite提供此扩展,从版本1.0.17开始通过EFS,从1.0.24.3 beta开始通过128位RC4寻呼机加密。

查看SEE以在SQLite3 shell中启用加密。

相关问题