Here are some pointers, that could help:
You can call Statement.cancel
from another Thread to stop that statement
From the javadoc http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#cancel()
Cancels this Statement object if both the DBMS and driver support aborting an SQL statement. This method can be used by one thread to cancel a statement that is being executed by another thread.
Statement.cancel is supported by mysql driver since version 5.0
EDIT
You can also specify the maximum time a query can take by using Statement.setQueryTimeout(int seconds)
http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#setQueryTimeout(int)