Nonstop Database, HiRDB Version 9 UAP Development Guide

[Contents][Index][Back][Next]

9.2.1 Creating an external Java stored routine

To code an external Java stored routine:

  1. Code the Java program (create a Java file).
  2. Compile (create a Class file).
  3. Test and debug.
  4. Archive in JAR format (create the JAR file).
Organization of this subsection
(1) Coding a Java program (creating a Java file)
(2) Compiling (creating a Class file)
(3) Testing and debugging
(4) Archiving in JAR format (creating a JAR file)

(1) Coding a Java program (creating a Java file)

Code the program that is to be registered as an external Java stored routine.

For notes about Java program coding, see 9.4 Notes about Java program creation.

The following figure shows an example of Java program coding.

Figure 9-2 Example of Java program coding

[Figure]

(2) Compiling (creating a Class file)

Create a Class file from the Java file using the javac command.

The following figure shows an example of compilation.

Figure 9-3 Example of compilation

[Figure]

Explanation
If you specified package for the Java file, specify the -d option during compilation. When the Java file is compiled, a directory with the specified package name is created and a Class file is created in that directory.

(3) Testing and debugging

Execute the compiled file on the client's Java virtual machine to test and debug it.

For notes about testing and debugging, see 9.5 Notes about testing and debugging.

The following figure provides an overview of testing and debugging.

Figure 9-4 Overview of testing and debugging

[Figure]

(4) Archiving in JAR format (creating a JAR file)

Use the jar command to create a JAR file from multiple Class files.

For notes about JAR file creation, see 9.6 Notes about JAR file creation.

The following figure shows an example of archiving in the JAR format.

Figure 9-5 Example of archiving in JAR format

[Figure]