When I call PreparedStatement.cancel() in a JDBC application, does it actually kill it in an Oracle database?

前端 未结 3 556
太阳男子
太阳男子 2020-12-03 04:22

I have Java JDBC application running against an Oracle 10g Database. I set up a PreparedStatement to execute a query, and then call ps.executeQuery() to run it. Occasional

3条回答
  •  暖寄归人
    2020-12-03 04:39

    The answer is that it's a quality-of-implementation issue. If you look at the javadoc for Statement.cancel(), it says it'll happen "if both the DBMS and driver support aborting an SQL statement".

    In my experience with various versions of Oracle JDBC drivers, Statement.cancel() seems to do what you'd want. The query seems to stop executing promptly when cancelled.

提交回复
热议问题