Scalable Database Server, HiRDB Version 8 UAP Development Guide

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

18.3.11 Creating and executing a UAP

Organization of this subsection
(1) Executing the SQLJE translator
(2) Compiling and executing an UAP

(1) Executing the SQLJE translator

1. Set environment variables.
When the HiRDB client is the IPF version of UNIX:
Set environment variables as shown below. The underlined portion is the default installation directory.
  • For HiRDB/Developer's Kit
    CLASSPATH=$CLASSPATH:/HiRDB/pdsqlj.jar1
  • For HiRDB/Run Time
    CLASSPATH=$CLASSPATH:/HiRDB/pdruntime.jar2
    CLASSPATH=$CLASSPATH:/HiRDB/pdnativert.jar3
    1 For the 32-bit mode HP-UX (IPF) version, this setting becomes pdsqlj32.jar.
    2 For the 32-bit mode HP-UX (IPF) version, this setting becomes pdruntime32.jar.
    3 For the 32-bit mode HP-UX (IPF) version, this setting becomes pdnativert32.jar.
When the HiRDB client is Windows:
Choose Control Panel, System, System Properties, and Environment in that order, and then specify as shown below. The underlined portion is the default installation directory:
  • For HiRDB/Developer's Kit
    CLASSPATH=%CLASSPATH%:\HiRDB\pdsqlj.jar
  • For HiRDB/Run Time
    CLASSPATH=%CLASSPATH%\HiRDB\pdruntime.jar
    CLASSPATH=%CLASSPATH%\HiRDB\pdnativert.jar

2. Executing the SQLJ Translator
The SQLJ Translator runs on a Java virtual machine.
Format
 pdjava [option] file-name-1.sqlj [file-name-2.java]
Description
option
Table 18-8 lists the SQLJ Translator options.
file-name-1
This is a UAP source file that describes SQLJ.
file-name-2
This is a post-source file.
file-name-1 and file-name-2 may contain a path. If file-name-2.java is not specified, file-name-1.java is assumed.

Table 18-8 SQLJ Translator options

Options Coding format Explanation
-dir -dir=directory-name Specifies the direction in which to create the post-source file.
-d -d=directory-name
-status -status Displays the internal status for preprocessing. This is a debugging option.
-J -J-option Specifies a Java virtual machine option to be used during the execution of the SQLJ Translator.
-version -version Displays the version of the SQLJ translator. No translation is performed.
-help -help Specified to display an option explanation. No translation is performed.
-native -native Generates a post source for the native interface. If you are specifying multiple options, be sure to specify this option first.
-d 64 -d 64 Specifies that the SQLJ translator is to be executed with the 64-bit mode HP-UX (IPF) version.
Notes
  1. When specifying multiple options, use spaces to separate the options.
    Up to two options can be specified for the standard interface version, and up to three options (including -native) for the native interface version. If more options are specified, an error occurs.
  2. The -native option for using the native interface version must be specified first. If the -native option is not specified first, an error occurs.
  3. If the -help or -version option is specified, the other options are ignored. However, it both -help and -version are specified at the same time, both are valid.
Execution example
Execution examples are shown below.
  • For the standard interface version
 
Example 1: pdjava file-name.sqlj
Example 2: pdjava -dir=d:\sqljsrc file-name.sqlj
Example 3: pdjava -d64 file-name.sqlj*
 
* This example is for the 64-bit mode HP-UX (IPF) version.
  • For the native interface version
 
Example 1: pdjava -native file name.sqlj
Example 2: pdjava -native -dir=d:\sqljsrc file name.sqlj
Example 3: pdjava -native -d64 file name.sqlj*
 
* This example is for the 64-bit mode HP-UX (IPF) version.

(2) Compiling and executing an UAP

1. Setting environment variables
See step 1 in (1) Executing the SQLJ Translator.

2. Compiling the post-source file
Use the Java compiler to compile the post-source file generated by the SQLJ Translator. The format used for compilation follows:
 javac file-name-2.java

3. Setting the path to the JDBC driver in CLASSPATH
For details on setting up a path for the JDBC driver, see 16.1 Installation and environment setup.

4. Using DriveManager to connect to a database
For details about database connection using DriverManager, see 16.2.1 Driver class.

5. Using the Java Virtual Machine to execute the CLASS file
Use the Java Virtual Machine to execute the Class file. The execution format follows:
 java file-name-2

When the 32-bit mode HP-UX (IPF) version is used, the execution format is as follows:

 
 java -d64 file-name-2