1

It gets me angry it gets me crazy i 've been looking for the past 1 week for a solution and i cannot find any. I had successfully created a database using System.Data.SQLite from visual studio and everything worked perfectly until i decided to use a password.

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();

As you can see i set a password "test". The program works fine with db.open() the db is readable and i see the tables normally.

When i want to read the db file from sqlite3 shell it says: Error: File is encrypted or is not a database which is what i expected to happen as it is protected now.

And here is my main question. How do i open the db file now from the shell so i can handle it by using sql commands in case i want to...? Where do i put the password "test" i set above?

LS_ᴅᴇᴠ
  • 10,823
  • 1
  • 23
  • 46
Breakeridis
  • 46
  • 1
  • 5

1 Answers1

1

SQLite doesn't nativelly support encryption.

System.Data.SQLite provides this extension, through EFS since version 1.0.17, and through 128-bit RC4 pager encryptation since 1.0.24.3 beta.

Take a look at SEE to enable encryption in SQLite3 shell.

schoetbi
  • 12,009
  • 10
  • 54
  • 72
LS_ᴅᴇᴠ
  • 10,823
  • 1
  • 23
  • 46