Home > Software design >  Opening a c# sqlite-net-sqlcypher database in a SQLite manager and vice versa
Opening a c# sqlite-net-sqlcypher database in a SQLite manager and vice versa

Time:04-25

Situation : Windows 11 - Latest updates; .NET 6 console app - latest updates; sqlite-net-sqlcypher nuget package (1.8.116) - also latest version; Both Visual Studio (2019 and 2022) and Rider - All latest versions)

I have created a little test application (see below)

var options = new SQLiteConnectionString(databasePath, true, "testpassword");
var db = new SQLiteConnection(options);

db.CreateTable<AttributionRecord>();

db.InsertOrReplace(new AttributionRecord(-1, "Test01", "Me", "Test Attribution 01"));

string queryString = "select * from AttributionRecord";

List<AttributionRecord> list = db.Query<AttributionRecord>(queryString);

foreach (AttributionRecord attributionRecord in list)
{
    Console.WriteLine($"{attributionRecord.Id} - For Who : {attributionRecord.AttributionForWho} - For What : {attributionRecord.AttributionForWhat} - Attribution : {attributionRecord.Attribution}");
}

That all works fine and I (finally) have an encrypted SQLite database. But when I try to open one of my newly created databases in either DB Browser (older versions (3.10.1) and newer versions (3.12.1)) and even in a bought app : SQLiteManager (Version 4.8.3) (from SQLabs : https://www.sqlabs.com/sqlitemanager.php indicated that they support sqlcypher encrypted databases), I just cannot seem to open the database.

The reverse is also true, when I try to open a database protected with sqlcypher and created via the managers, I cannot open it in c# (sqlite exception - file is not a database).

This is not a duplicate of some other question on stackoverflow and I have tried all what was to find on it. For the older DB Browser, I used 4096 as the page size as that was advertised as the default page size for sqlcypher databases.

CodePudding user response:

With SQLiteStudio (version 3.3.3) I can open and edit my encrypted databases and tables.

I'm just a little disappointed that a commercial product like SQLiteManager is unable to do what a free product can.

To be honest, I had never heard from SQLiteStudio before, but it is a nice open source project that does the job.

  • Related