CommandTimeout
This property specifies the minimum number of seconds that the command is allowed to execute before terminating with an exception on a particular OracleConnection
object.
Declaration
// C# public int CommandTimeout { get; set;}
Property Type
System.Int32
Exceptions
InvalidArgument
- The specified value is less than 0
or greater than System.Int32.MaxValue
.
System.ObjectDisposedException
- This property cannot be accessed after the OracleConnection
object is already disposed.
Remarks
Default is 0
(seconds), which enforces no time limit.
When the specified timeout value expires before a command execution finishes, ODP.NET will begin the process of canceling the command. If cancellation is successful, then an exception is thrown with the message: ORA-01013: user requested cancel of current operation. Other possible exceptions thrown after a command timeout expiration occurs include ORA-00936 and ORA-00604. If the command is executed in time without any errors, then no exceptions are thrown.
ODP.NET does not guarantee a command will be cancelled at the exact moment the timeout value is reached. The timeout value is the minimum time to allow a command to complete before the cancellation process begins. It is possible for commands to complete after the timeout value expires.
In a situation where multiple OracleCommand
objects use the same connection, the timeout expiration on one of the OracleCommand
objects may terminate any of the executions on the single connection. To make the timeout expiration of a OracleCommand
cancel only its own command execution, simply use one OracleCommand
for each connection if that OracleCommand
sets the CommandTimeout
property to a value greater than 0
.
The CommandTimeout
property can be configured on OracleCommand
, OracleConnection
, and OracleConfiguration
objects. By default, OracleConnection
CommandTimeout
property value inherits OracleConfiguration
CommandTimeout
property value at construction time; OracleCommand
CommandTimeout
property value inherits OracleConnection
CommandTimeout
property value at construction time. The value of OracleCommand
CommandTimeout
will be used during command execution.