0

I have a .sqlite file which is protected by a password. When I use viewer like SQLiteStudio to connect it, I need to manually input the password in UI.

When I use c# to connect it, the codes as below work very well:

string db_file_path = "xxx.sqlite";
string conn_conf = $"Data Source={db_file_path};Version=3;password={db_passwd}";
SQLiteConnection conn = new SQLiteConnection(conn_conf);

But for python, the code is like this:

sqlite_file = '/xxx.db'
conn = sqlite3.connect(sqlite_file)
c = conn.cursor()

"OperationalError: unable to open database file" appear on the connect()

So, how to use the password??? How to open it???

Fanny
  • 111
  • 2
  • 7
  • I don't think password protection is a native feature of sqlite. You'd have to find out how C# is doing it and write python code to handle that. Or maybe find a project that already does that. –  Jul 03 '18 at 09:15
  • see https://stackoverflow.com/questions/5669905/sqlite-with-encryption-password-protection –  Jul 03 '18 at 09:17

0 Answers0