简体   繁体   中英

How to cancel a statement with derby?

I have a very long sql statement, with java derby database, and I should want provide to the user a "cancel" things. But I get :

Caused by: java.sql.SQLException: Feature not implemented: cancel.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)

So how can I do something like that with derby ?

Thanks.


Edit 1

There is no next loop in my request ; here is my big sql call:

"DELETE FROM TABLE "
+ "WHERE "
+ "REF_TICKET IN 
+   "(SELECT NTICKET FROM OTHER_TABLE WHERE "
+   "REF_OPEN IN 
+    (SELECT OPEN FROM AGAIN_ANOTHER_TABLE WHERE "
+    "{fn TIMESTAMPDIFF( SQL_TSI_DAY, TIMECLOSE, CURRENT_DATE)} > 365))");

So it's all in one statement.

It's usually not the ExecuteQuery() call that takes very long, but the ResultSet.next() loop that runs for a long time, fetching all the rows. So just check for the user's cancel request during your row-fetching loop, say, every hundred rows or so.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM