Repository navigation
SQLRDD: CommandTimeout connection option - #2134
Merged
RobertvanderHulst merged 1 commit intoOct 28, 2026
Merged
Conversation
Every statement ran with the ADO.NET provider's default timeout (30 s for SQL Server), and there was no way to change it. With tables of millions of rows a count, an index or a first page of a function-key order can take longer; the statement is then cancelled and reported as an error, which for a read means no rows. The new connection option CommandTimeout (seconds, 0 = no limit, default -1 = the provider's default) is applied to every SqlDbCommand before it runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The RDD had no way to set the timeout of its statements, so every statement ran with the provider default (30 seconds for SQL Server). On large tables some statements take longer: creating an index on a table with millions of rows, a count, or an import. They were cancelled after 30 seconds and reported like any other error, which for a read means no rows.
What changed
CommandTimeout: the time in seconds a statement may run before it is cancelled. 0 means no limit; the default -1 keeps the provider default, so nothing changes unless it is set.SqlDbCommandapplies it to the ADO.NET command before every execution (ExecuteReader,ExecuteScalar,ExecuteNonQuery,GetSchemaTable).or at run time, e.g. for a maintenance step:
Testing
Our ERP has used it since moving a customer dataset (72 GB, tables with up to 14 million rows) to SQL Server: the connection gets
CommandTimeoutfrom its configuration, and the synchronisation at program start (import of the DBF data, creating and rebuilding indexes) runs with 0. The import (more than two hours, singleCREATE INDEXstatements of several minutes) and a rebuild of 316 indexes (20 minutes) ran without timeouts. Without the option set, the behaviour is unchanged.🤖 Generated with Claude Code