Is it possible to abort a long query with iBATIS?

I have a GUI that allows users to run long queries. Sometimes users complain about the execution of requests and would like to cancel them. Queries are done using iBATIS for Oracle database and I know the java.sql.Statement interface defines a cancellation method that may or may not be implemented by the driver. So my question is whether it is possible to use iBATIS to call this method to cancel the request (given the correct driver), or is there another way to interrupt an ongoing long request.

+3


source to share


1 answer


Well,
my guess is that once it hit the DB server, canceling it is actually a "DB provider" problem.
If your requirement is to cancel the request
when it comes to your application
(i.e. if it reaches the Oracle DB server and runs there, you're fine until you get the result), consider using Future , which has a cancel method.
You can submit "Callable" to run your request and it will return the correct type object, which is the implementation.
If you need to undo, just use the undo method for the future object. You can also check with "isCanceled" to see if a claim has been submitted and handle your code appropriately.



+2


source







All Articles