2.23 GET_JAVA_STORED_ROUTINE_SOURCE specification

Organization of this section
(1) Function
(2) Format
(3) Operands
(4) Rules on GET_JAVA_STORED_ROUTINE_SOURCE specification results
(5) Common rules
(6) Notes
(7) Example

(1) Function

A GET_JAVA_STORED_ROUTINE_SOURCE specification extracts a Java class source file from a JAR file.

Java routines can be used in the HP-UX, Solaris, AIX 5L, Linux, and Windows versions of HiRDB. In the case of HP-UX, Solaris, and AIX 5L, Java routines cannot be used if a POSIX library version of HiRDB is not set up (by executing the pdsetup command) or if a POSIX library version of HiRDB has been reinstalled as a non-POSIX library version of HiRDB. For details of the pdsetup command, see the manual HiRDB Version 8 Command Reference.

(2) Format

GET_JAVA_STORED_ROUTINE_SOURCE (class-name, JAR-filename
     [, source-file-maximum-length])

(3) Operands

Specifies a class name as a character string of no more than 255 bytes; following is the format:

'[package-name.] class-identifier'

In class-name, VARCHAR type value expressions with a maximum of 255 bytes can be specified.

If only a ? parameter or an embedded variable is specified in class-name, the ? parameter or the embedded variable must be a simple structure.

Specifies the name of a JAR file as a character string of no more than 255 bytes.

In JAR-filename, VARCHAR type value expressions with a maximum of 255 bytes can be specified.

A JAR file name must not be specified as a path name.

If only a ? parameter or an embedded variable is specified in JAR-filename, the ? parameter or the embedded variable should be a simple structure.

Specifies as an integer literal the maximum length (in bytes) of the source file from which data is to be extracted.

The specifiable range is 1 to 2,147,483,647. The null value cannot be specified. The default is 2,147,483,647.

(4) Rules on GET_JAVA_STORED_ROUTINE_SOURCE specification results

  1. The result of a GET_JAVA_STORED_ROUTINE_SOURCE specification will be the BLOB type without the NOT NULL constraint (null value will be permitted) and a definition length equal to the length specified in source-file-maximum-length.
  2. The result of a GET_JAVA_STORED_ROUTINE_SOURCE specification is the contents of the file that is fetched from the JAR file (any portion that is in excess of the value specified in source-file-maximum-length is truncated).
  3. The result of a GET_JAVA_STORED_ROUTINE_SOURCE specification is the null value in any of the following cases:
    • Any argument is the null value.
    • The specified JAR file has not been installed.
    • No source file associated with the specified class is found in the JAR file.

(5) Common rules

  1. GET_JAVA_STORED_ROUTINE_SOURCE can be specified in the following places:
    • Singly in a selection expression in an outermost query specification
    • In an argument of the LENGTH scalar function in a selection expression in an outermost query specification
  2. If the ORDER BY clause is specified, GET_JAVA_STORED_ROUTINE_SOURCE cannot be specified in a sort key field.
  3. GET_JAVA_STORED_ROUTINE_SOURCE cannot be specified in a selection expression in a derived query expression in the WITH clause.
  4. When a set operation is performed, GET_JAVA_STORED_ROUTINE_SOURCE cannot be specified in a column for the derived table to be subject to the operation.
  5. A GET_JAVA_STORED_ROUTINE_SOURCE specification cannot be specified in a selection expression for a subquery (including a derived table in a FROM clause).
  6. GET_JAVA_STORED_ROUTINE_SOURCE cannot be specified in a selection expression in a derived query expression in a view definition.
  7. GET_JAVA_STORED_ROUTINE_SOURCE cannot be specified in a selection expression in a query specification in an INSERT statement.
  8. GET_JAVA_STORED_ROUTINE_SOURCE only references a class identifier that is obtained by removing the package name from the class name. Therefore, if there are multiple source files with the same class identifier in the JAR file, the result will be a linkage of the multiple source files.
  9. GET_JAVA_STORED_ROUTINE_SOURCE regards character strings with 'java' suffixed to the specified class identifier as Java-class source files.
  10. In order for a source file to be fetched by GET_JAVA_STORED_ROUTINE_SOURCE, it must be available in the JAR file. For details of creating JAR files, see the HiRDB Version 8 UAP Development Guide.

(6) Notes

  1. GET_JAVA_STORED_ROUTINE_SOURCE operates on JAR files that are installed in HiRDB.
  2. In order for SQL statements that include a GET_JAVA_STORED_ROUTINE_SOURCE specification to be executed, the Java environment must be installed.
  3. Class names and JAR file names must not include space characters.

(7) Example

Extract the contents of the source file for a Java routine (JAVAROUTINE) registered in a schema (USER1):

SELECT GET_JAVA_STORED_ROUTINE_SOURCE(CLASS_NAME,JAR_NAME)
 FROM MASTER.SQL_ROUTINES
  WHERE ROUTINE_SCHEMA='USER1' AND ROUTINE_NAME='JAVAROUTINE'