How do I cancel a long running postgres query via JDBC or Java?

The usecase would be that an user starts a query on a postgres database via a front end, but then he decides otherwise and wants to abort/cancel the currently running query.

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

Call java.sql.PreparedStatement.cancel() method. Check whether postgres JDBC driver supports this method. As far as I can see from the source code of the latest postgres JDBC driver it does stop the query.

link|improve this answer
Thanks Boris, thats it. Works like a charm. – Dieter Oct 6 '09 at 15:42
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.