Interrupt an SQL request

To interrupt the database server, you can use the sqlbreak() library function.

Sometimes you might need to cancel an SQL request. If, for example, you inadvertently provide the wrong search criteria for a long query, you want to cancel the SELECT statement rather than wait for unneeded data. While the database server executes an SQL request, the application is blocked. To regain control, the application must interrupt the SQL request.

You might want to interrupt an SQL request for some of the following reasons:
  • The application user wants to terminate the current SQL request.
  • The current SQL request has exceeded some timeout interval.
Important: The application must handle any open transactions, cursors, and databases after it interrupts an SQL request.