Compiling the Java code

A UDR written in Java™ code is implemented by a static method in a Java class.

About this task

To make the Java source code into an executable format:

Procedure

  1. Compile the java files with the javac command to create class files.
  2. Use the jar command to collect a set of class files into a JAR file.
    For example:
    # makefile for admin class
    JAR_NAME = admin.jar
    all:
        javac *.java
        jar cvmf manifest.txt $(JAR_NAME) 
             deploy.txt *.class
        mv $(JAR_NAME) $(ONEDB_HOME)/jars
    cleanup:
        rm -f *.class $(ONEDB_HOME)/jars/$(JAR_NAME) 

Results

JAR files contain Java classes that in turn contain static methods corresponding to SQL UDRs. JAR files can also contain auxiliary classes and methods that are used by the UDRs (for example, to perform SQL-to-Java type mapping).

See Java technology dependencies.