I have a .NET 4 application (in mixed mode) with System.Data.Sqlite (1.0.82) for database access to an encrypted database.
When I install the application to "c:\program files\myfolder" the connect to the sqlite database file is slow. Log files show that it's the sqlite connect statement that is delayed by a few seconds.
The problem does not occur when I do the following:
I have no clue what can be the cause of this...
If the DB file is in the application directory then it's most likely that the UAC is moving it to the "...appdata\Local\VirtualStore\Program Files" directory. Best practice is to create your own appdata\MyApp folder and copy the pristine DB out of the c:\program files\MyApp folder.
It helps to open the database in read-only mode. (You should keep only read-only stuff in the program files folder anyway.)
Just append ";Read Only=True"
to the connection string.
private const string CONN_TEMPL = "Data Source={0};Version=3;Read Only=True";
var conn = new SQLiteConnection(
String.Format(CultureInfo.InvariantCulture, CONN_TEMPL, databasePath)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With