[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
Hello,

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

We have defined the connection string as follows:

data
source=<path/to/db_file>;DateTimeKind=Utc;Version=3;Pooling=True;Synchronous=Off;journal
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();
try
{
    var conn = new SQLiteConnection(ConnectionString);
    // Busy Timeout = 0, Default Timeout = 30

    conn.Open();
    // Busy Timeout = 30001, Default Timeout = 31

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

Please let me know if we are doing anything wrong.

Thanks in advance.
Rahul
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users