CANCEL_APPLICATION stored procedure

The CANCEL_APPLICATION stored procedure cancels a query that is associated with a particular application handle. The application handle, also known as the agent ID, can be used to uniquely identify an active application. Use this procedure when you want to cancel a long-running query.


Only the bigsql user or a user with Db2® Big SQL administrative privileges can run this Hadoop procedure. However, the bigsql user can grant EXECUTE permission on the CANCEL_APPLICATION procedure to any user, group, or role.


Read syntax diagramSkip visual syntax diagram CANCEL_APPLICATION ( appl-handle )


An integer that uniquely identifies a specific application connection to the Db2 Big SQL server. To determine the application handle, run the DB2® LIST APPLICATIONS command.

Usage notes

Call this procedure from a Java™ application that uses a JDBC connection, from another stored procedure, or from the command line.


For a use case that shows how a privileged user can make it possible for regular users to cancel their own queries, see How to cancel running queries in Db2 Big SQL.