SQL query execution and monitoring
You can monitor and modify the execution of an SQL query by using the execution context associated with it. An execution context is an instance of the class sqlj.runtime.ExecutionContext; an execution context is associated with each executable SQL operation in an Embedded SQLJ program.
#sql [execCtx] {SQL_statement};
If you do not explicitly supply an execution context, the SQL statement uses the default execution context for the connection context you are using.
#sql [connCtx, execCtx] {SQL_statement };
You use the getExecutionContext() method of the connection context to obtain that connection’s default execution context.
The execution-context object has attributes and methods that provide information about an SQL operation and the ability to modify its execution.
Attribute | Description |
---|---|
MaxRows |
The maximum number of rows a query can return |
MaxFieldSize |
The maximum number of bytes that can be returned as data for any column or output variable |
QueryTimeout |
The number of seconds to wait for an SQL operation to complete |
SQLWarnings |
Any warnings that occurred during the last SQL operation |
UpdateCount |
The number of rows updated, inserted, or deleted during the last SQL operation |