title: How to close a transaction gracefully when stop a application JDBC
body: <p>I am using transaction to move data from one place to another. Some tables are huge, I am tuning the application, but sometimes I don't want wait, I just kill the application. But the problem is that the query is already sent to the DB, although I kill my application(codes), the transaction(query) is not canceled. Is there any way to cancel or roll back the transaction when I kill my application?</p>
  
  <p>I know that I can login to the DB server and kill the query. That's not the method I want to use. I am asking how to rollback or cancel the query in the codes when the application is killed?</p>