Try OpenEdge Now
skip to main content
SQL Reference
SQL Reference : OpenEdge SQL Statements : SET PRO_CONNECT QUERY_TIMEOUT
 

SET PRO_CONNECT QUERY_TIMEOUT

Defines the maximum number of seconds during which a query should execute for the current SQL Server connection.

Syntax

SET PRO_CONNECT QUERY_TIMEOUT n ;

Parameter

n
Indicates the maximum number of seconds during which a query should execute before it is automatically cancelled by the SQL server.

Notes

*The number of seconds specified is the maximum time allowed for the execution of the following protocol messages:
*Query statement prepare
*Query statement execution
*Query fetch
*The value specified by n applies to all subsequent protocol messages of these types until the timeout value is cleared. This may be accomplished simply by specifying a value of 0 on subsequent execution of the statement.

Example

This example sets the query timeout to 30 seconds:
Statement stmt = connection.createStatement();
String MySetQueryTimeout;
String MyClearQueryTimeout;
MySetTimeout = "SET PRO_CONNECT QUERY_TIMEOUT 30";
MyClearTimeout = "SET PRO_CONNECT QUERY_TIMEOUT 0";
// Set SQL Server timeout for query execute and fetch
stmt.executeUpdate( MySetQueryTimeout );
// Add code here to perform queries
// Clear SQL Server timeout for query execute and fetch
stmt.executeUpdate( MyClearQueryTimeout );