Restrictions on Java routines

There are multiple restrictions that apply to Java™ routines that you need to review before you create these routines.

The following restrictions apply to Java routines:

  • The built-in procedure install_jar used to deploy Java routine code in JAR files to the database server file system cannot be called in a Java database application when you use the Universal JDBC Driver. This driver does not support the install_jar procedure.

    The alternative is to use the Command Line Processor.

  • The PROGRAM TYPE MAIN clause is not supported in CREATE PROCEDURE or CREATE FUNCTION statements for Java routines regardless of the PARAMETER STYLE clause value specified.
  • The following features are not supported by parameter style JAVA:
    • Table functions
    • Scratchpads in functions
    • Access to the DBINFO structure in functions
    • FINAL CALL invocation in functions

    The alternative is to create a Java function that use parameter style DB2GENERAL or to create the function in either the C or C++ programming language.

  • Java Native Interface (JNI) calls from Java routines are not supported.

    If you need to invoke C or C++ code from a Java routine, you can do so by invoking a separately defined C or C++ routine.

  • NOT FENCED Java routines are currently not supported. A Java routine that is defined as NOT FENCED is invoked as FENCED THREADSAFE.
  • Java stored procedures cannot depend on any non-system resources, such as properties files. If you call a Java stored procedure that depends on non-system resources, those resources are not loaded, and no error is returned.
  • Java generic table functions must be created using the DB2GENERAL parameter style.
  • Modifications to the Java Virtual Machine (JVM) or the JVM start arguments is not supported for external Java routines.
The following features are not supported with parameter style HIVE:
  • Table functions
  • Scratchpads in functions
  • Access to the DBINFO structure in functions
  • FINAL CALL invocation in functions
  • READS SQL DATA or CONTAINS SQL
  • EXTERNAL ACTION
  • NOT DETERMINISTIC
  • DISALLOW PARALLEL