Unable To Terminate Java Stored Procedure (Doc ID 335695.1)

Last updated on JUNE 01, 2011

Applies to:

Oracle Server - Enterprise Edition - Version: 10.1.0.3 and later   [Release: 10.1 and later ]
Information in this document applies to any platform.

Goal

You would like to terminate a Java Stored Procedure started from SQL*Plus. Killing the corresponding session in the database and in the SQL*Plus session on the client only marks the session KILLED, but the procedure continues to run.

Also, alter system kill session just eventually returns with ORA-00031 but the process continues to run.

How do you stop the Java stored procedure started from a sql*plus session?

Here is the Java Stored Procedure code.

import java.util.Properties;
class LogForever  {
public static void run() {
System.out.println("Starting Java Stored Procedure");int i = 0;
    while (true) {     System.out.println("Done loop " + i++ + ", waiting");
      try 
{     Thread.sleep(1000);
      } catch (InterruptedException e) {       System.out.println("Interrupted"+ e);      }
      Thread.yield();
    }
  }
}

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms