Cancel execution of MySQL queries from another thread

I have two threads. One is to extract data from the database, and the other is to display a progress indicator with a cancel button. If I click abort, the request executed by another thread should be canceled.

I know how to kill it from the command line; but, if any of you know about canceling a request from java, this will help me.

+4
source share
1 answer

Here are some pointers that might help:

You can call Statement.cancelfrom another thread to stop this statement

From javadoc http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#cancel ()

Statement, SQL. , .

Statement.cancel mysql 5.0

, Statement.setQueryTimeout(int seconds)

http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#setQueryTimeout(int)

+3

All Articles