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.
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.
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.