Recall or Cancel Active Query from Application

When the application runs a complex runNamedQuery and the result generally will take several minutes to return from SQL Server, how can one issue a query cancel request from the application?

Example: User doesn’t realize they set the date range to be a decade instead of a week… The query will happily return in an hour but they don’t want to wait. They close the perspective app but the gateway keeps a thread waiting on the query result. Maybe the user could hit a cancel button?

DB connections have a timeout setting, and most databases have their own internal timeouts. JDBC allows setting a timeout in seconds on a statement just before executing it. Deciding after a query starts is simply not supported.

1 Like

What Phil said. Also see this thread – even in the gateway it’s not really supported even though we have an enticing button for you to push.

Thank you for the quick replies.
To my knowledge the timeout on a statement cannot be changed after its fired so that would not serve the same purpose.

Kathy,
I saw your other post. Can one push the enticing cancel button from the designer or app?

No, and it's unlikely we'll add it because of the reasons outlined in the other post.

If this is a frequent enough problem, you might need to add some scripting guards to your button logic. Yes, the user would have to dismiss an extra popup if they really did want a decade, but that would be rare.