Interrupting thread doesn't kill the spawned db processes

I have a view, wherein upon the click of a button, a heavy duty query would run. This could last sometimes an hour to complete (only select, not upd/del). I accomplish this by using a feeder thread in the view, which works well, except if I choose to kill the execution (by the click of another button), the thread spawned from the UI gets killed and user gets control bk on the screen. But I have a method that is supposed to cancel the db processes that had gotten started, which doesn’t seem to work. I see that the db processes end up completing eventually, which defeats the purpose to some extent.

I have tried calling the method (to kill the db process) after the thread.interrupt() as well as from within the the catch block of InterruptedException, with no luck.

Anyone can point out what am missing?

as well as from within the the catch block of InterruptedException

I can just comment, that this is the correct place to do the “clean up”.

I guess you are using the JDBC cancel() method to stop the query:

https://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#cancel()

So maybe your current JDBC driver ignores that statement. Otherwise it should stop the execution.

Yes, using Statement.cancel, and the driver is ojdbc8-19.3

Thinking more about it, it’s not the jdbc driver. I say this coz the older version of this app (not on vaadin then) used the same driver, but that method truly cancelled the statements. So, am thinking I am just not calling it at the right place or way, but can’t figure what is.