[System.Data.SQLite] BusyTimeout and DefaultTimeout are not picked up from the connection string

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[System.Data.SQLite] BusyTimeout and DefaultTimeout are not picked up from the connection string

Phani Rahul Sivalenka

The question is related to the System.Data.SQLite library's connection
string parsing.

We have defined the connection string as follows:

mode=Memory;busytimeout=30001;default timeout=31

When a new SQLiteConnection instance is created using the above connection
string, the BusyTimeout and DefaultTimeout are still shown as 0 and 30
respectively on that connection. However, once we open the connection by
calling .Open() method, the values from the connection string are seen in
connection properties.

Expected busy timeout when a db lock occurs is now 30 sec as per the
connection string and as reflected on the connection object. But when we
log the elapsed time from the opening of the connection to its timing out
after the db lock error (inside the catch block) we see that the timeout is
around 60 sec.

var stopwatch = Stopwatch.StartNew();
    var conn = new SQLiteConnection(ConnectionString);
    // Busy Timeout = 0, Default Timeout = 30

    // Busy Timeout = 30001, Default Timeout = 31

    // DB lock while executing the command created on this connection
    log(stopwatch.ElapsedMilliseconds); // around 60000

Please let me know if we are doing anything wrong.

Thanks in advance.
sqlite-users mailing list
[hidden email]