View Ticket
Not logged in
Ticket UUID: 3eb097e917a7740f3499aae66e9a3cd021e9f81c
Title: Could not determine incorrect password
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Connection Resolution: Works_As_Designed
Last Modified: 2014-02-04 02:53:32
Version Found In: from NuGet
User Comments:
anonymous added on 2014-02-04 00:28:50:
Hello. Sorry for my bad English.
I use SQLite latest version and attemt to determine when password is wrong. I use this code:

var connectionString = new SQLiteConnectionStringBuilder
                           DataSource = dataSource, // (1) admin.db3, (2) admin.db3
                           Version = 3,
                           Password = password      // (1) admin,     (2) password
SQLiteConnection connection = new SQLiteConnection(connectionString);
connection.Authorize += (sender, args) => Debug.WriteLine(args);
connection.Close(); // (2) breakpoint

Test case:
(1) I create DB with DataSource = "admin.db3", Password = "admin"
(2) I connect to DB with DataSource = "admin.db3", Password = "password"
I expect throwing Exception or anything else, but nothing happens. At the breakpoint I see, that Status == Opened, ResultCode == Ok, ExtendedResultCode == Ok

Below this code begins NHibernate initialization, that logging "SQLite error (26): file is encrypted or is not a database" and not throwing Exception too.
As a result, I can find out about incorrect password only catching log from NHibernate.

I will be glad to help. Thank you for all that you do.

mistachkin added on 2014-02-04 02:53:23:
This is by design.  The error message only occurs when you try to read from -OR-
write to the underlying database file.  Opening the database does not typically
perform either operation.

It is recommended that you execute a SELECT statement on some well-known table
(e.g. "sqlite_master") immediately after opening the database in order to
determine if it is in a usable state.