Artem Zubkov
Artem Zubkov

Reputation: 559

Encrypting SQLite database in Delphi OLEDB

How to use encryption to SQLite DB in Delphi if i'm using SQLite ODBC Driver.
I must use ADO components for data access.

Upvotes: 5

Views: 2122

Answers (1)

da-soft
da-soft

Reputation: 7750

As I see from ODBC driver source, one of the 2 options:

  1. Compile ODBC driver with WITH_SQLITE_DLLS defined, so it will use sqlite3.dll. Then provide sqlite3.dll compiled with SQLITE_HAS_CODEC.
  2. Compile ODBC driver and SQLite engine with SQLITE_HAS_CODEC defined. Then link SQLite engine statically with ODBC driver.

SQLITE_HAS_CODEC means, that SQLite engine is compiled with build-in codec. By default SQLite has no codec. You can use SQLCipher instead of standard SQLite. Or obtain SQLite with Encryption Extension.

Then to connect to encrypted database using ODBC you will need to specify PWD=xxx in connection string.

Upvotes: 6

Related Questions