Canceling SQL from an IBM data server driver
You
can use the SQLCancel()
function for the C-based
drivers or the Statement.cancel
method for Java™-based drivers to cancel an SQL request running on a remote Db2 for z/OS server.
Before you begin
- IBM Data Server Driver for ODBC and CLI
- IBM Data Server Driver for JDBC and SQLJ type 4 connectivity
For more information, see IBM data server client and driver types
About this task
You can configure the cancel behavior by setting configuration properties for your client driver:
- For C-based drivers, configure the
InterruptProcessingMode
property. - For Java-based drivers, configure the
interruptProcessingMode
andqueryTimeoutInterruptProcessingMode
properties.
These properties determine the behavior when an application issues a cancel request or a query timeout interval is reached.
Procedure
To cancel SQL statements that are running on a remote Db2 for z/OS server:
SQLCancel()
function for C-based driver applications
or a Statement.cancel
method for Java-based driver applications. Results
When you cancel an SQL statement from a client application, you do not eliminate the original connection to the remote server. The original connection remains active to process additional SQL requests. Any cursor that is associated with the canceled statement is closed, and the Db2 server returns an SQLCODE of -952 to the client application when you cancel a statement by using this method.
You can cancel only dynamic SQL codes that excludes transaction-level statements (CONNECT, COMMIT, ROLLBACK) and bind statements from a client application.