DB2 10.5 for Linux, UNIX, and Windows

DB2Connection.BatchCommandTimeout property

Gets or sets the wait time in seconds before a command that consists of chained SQL statements is terminated. You can use the BatchCommandTimeout property to set the command timeout value of the DB2Connection object when the Chaining property is set to True.
Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax

[Visual Basic]
Public Property BatchCommandTimeout As Integer
[C#]
public int BatchCommandTimeout {get; set;}
[C++]
public: __property int get_BatchCommandTimeout();
public: __property void set_BatchCommandTimeout(int);
[JScript]
public function get BatchCommandTimeout() : int;
public function set BatchCommandTimeout(int);

Property value

You can change the BatchCommandTimeout property value only before you call the EndChain() method.

The default value for the BatchCommandTimeout property is 60 seconds.

If you set the BatchCommandTimeout property to 0, no timeout can occur.

The BatchCommandTimeout property value overrides the CommandTimeout and QueryTimeout property values.

Example

The following example shows the use of the BatchCommandTimeout property:
DB2Connection connection = new DB2Connection("database=sample;");
connection.Open();
connection.BeginChain();
/* Chain of SQL statements to execute using DB2Command object */

/* Setting command timeout for this chain, increasing it to 90 secs from default 60 secs */
connection.BatchCommandTimeout = 90;

connection.EndChain();
connection.Close();