I have a very complex oracle stored procedure that searches and retrieves some data. The procedure returns an output parameter - an oracle cursor. I execute the procedure by JDBC:
CallableStatement stmt = conn.prepareCall("{call myprocedure(?,?,?,?}");
The problem is, the queries can sometimes take quite long (few minutes) and i would like user to be able to cancel the query anytime by clicking button. I have reference to stmt object, but unfortunatelly calling stmt.cancel() (from other thread) has NO EFFECT.
On the other hand when i change the CallableStatement sql to some query like:
CallableStatement stmt = conn.prepareCall("select * from all_objects");
i get "java.sql.SQLTimeoutException: ORA-01013: user requested cancel of current operation" after calling stmt.cancel() - so thats the right reaction.
Does that mean than i cannot cancel stored procedure call via jdbc, but only simple select statements? Does anyone else had and resolved similar problem?
I guess i could cancel the query by oracle kill session, but i use connection pooling (jboss) and i have plenty of sessions for the same user existing.
Database Product Version is Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production JDBC Driver Version is 11.2.0.4.0
any help will be appreciated.