Scalable Database Server, HiRDB Version 8 UAP Development Guide

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

9.2.1 Coding a Java stored routine

To code a Java stored routine, use the following procedure:

  1. Coding a Java program (creating a Java file)
  2. Compiling (creating a Class file)
  3. Testing and debugging
  4. Archiving in the JAR format (creating 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 the JAR format (creating a JAR file)

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

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

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

Figure 9-2 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.

Figure 9-3 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.

Figure 9-4 shows an overview of testing and debugging.

Figure 9-4 Overview of testing and debugging

[Figure]

(4) Archiving in the 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.

Figure 9-5 shows an example of archiving in the JAR format.

Figure 9-5 Example of archiving in the JAR format

[Figure]