Oracle8i SQLJ Developer's Guide and Reference Release 8.1.5 A64684-01 |
|
By default, SQLJ is configured to run under the Sun Microsystems JDK 1.1.x (or later) and to use the Sun compiler javac
. These are not requirements, however. You can configure SQLJ to work with alternative VMs or compilers. To do so, you must supply SQLJ with the following information:
-vm
option)
-compiler-executable
option)
There is a set of SQLJ options that allow you to provide this information. These options are described in "Java and Compiler Options".
SQLJ also defaults to the Oracle profile customizer but can work with alternative customizers as well. See "Customization Options" for how to instruct SQLJ to use a different customizer.
Other SQLJ advanced flags and options are discussed in "Advanced Translator Options". More basic flags and options are discussed in "Basic Translator Options".
If you use a Java compiler other than javac
, then the following is required:
As always, SQLJ processes compiler line information so that it refers to line numbers in the original .sqlj
file, not in the produced .java
file.
The following options relate to the operation of the Java VM and Java compiler:
-vm
(specify the Java VM; command-line only)
-compiler-executable
(specify the Java compiler)
-compiler-encoding-flag
-compiler-output-file
-compiler-pipe-output-flag
For some VM and compiler configurations, there may be problems with the way SQLJ normally invokes the compiler. The following option can be used to alleviate this:
You can also pass options directly to the particular VM or compiler you use, through the -J
and -C
prefixes discussed in "Prefixes that Pass Option Settings to Other Executables".
Note:
The |
Use the -vm
option if you want to specify a particular Java VM for SQLJ to use. Otherwise SQLJ uses the standard java
from the Sun Microsystems JDK.
You must specify this command on the command line; you cannot specify it in a properties file because properties files are read after the VM is invoked.
If you do not specify a directory path along with the name of the VM executable file, then SQLJ looks for the executable according to the PATH
setting of your operating system.
Note:
Special functionality of this option, |
-vm=Java_VM_name
-vm=/myjavadir/myjavavm
n/a
n/a
java
Use the -compiler-executable
option if you want to specify a particular Java compiler for SQLJ to use. Otherwise SQLJ uses the standard javac
from the Sun Microsystems JDK.
If you do not specify a directory path along with the name of the compiler executable file, then SQLJ looks for the executable according to the PATH
setting of your operating system.
The following is assumed of any Java compiler that you use:
STDOUT
on a UNIX system) or, alternatively, to a file (as directed by the -compiler-output-file
option, described below).
-d
option, which determines the root directory for class files.
Note:
If you use a compiler that does not support an |
-compiler-executable=Java_compiler_name
-compiler-executable=/myjavadir/myjavac
sqlj.compiler-executable=Java_compiler_<path+>name
sqlj.compiler-executable=myjavac
javac
As mentioned in "Encoding for Input and Output Source Files (-encoding)", it is typical that when you employ the -encoding
option to specify an encoding character set for SQLJ to use, SQLJ passes this to the Java compiler for the compiler to use as well. Set the -compiler-encoding-flag
to false
if you do not want SQLJ to pass the character encoding to the compiler (for example, if you are using a compiler other than javac
, and it does not support an -encoding
option by that name).
-compiler-encoding-flag=true/false
-compiler-encoding-flag=false
sqlj.compiler-encoding-flag=true/false
sqlj.compiler-encoding-flag=false
true
If you have instructed the Java compiler to output its results to a file, then use the -compiler-output-file
option to make SQLJ aware of the file name. Otherwise SQLJ assumes that the compiler outputs to the standard output device (such as STDOUT
on a UNIX system).
-compiler-output-file=output_file_path+name
-compiler-output-file=/myjavadir/mycmploutput
sqlj.compiler-output-file=output_file_path+name
sqlj.compiler-output-file=/myjavadir/mycmploutput
none (standard output)
By default, the javac
compiler provided with the Sun Microsystems JDK writes error and message output to STDERR
. SQLJ, however, expects such compiler output to be written to STDOUT
so that it can be captured reliably.
If SQLJ sets the javac.pipe.output
system property to true
, which is SQLJ's default behavior when it invokes the Java compiler, then compiler error and message output will be sent to STDOUT
. You can specify -compiler-pipe-output-flag=false
, however, to instruct SQLJ not to set this system property when it invokes the Java compiler. You should do this, for example, if the Java compiler you are using does not support the javac.pipe.output
system property.
You can set this flag in a properties file as well as on the command line or in the SQLJ_OPTIONS
environment variable.
-compiler-pipe-output-flag=true/false
-compiler-pipe-output-flag=false
sqlj.compiler-pipe-output-flag=true/false
sqlj.compiler-pipe-output-flag=false
true
By default, the following sequence occurs when you invoke the sqlj
script:
sqlj
script invokes your Java VM, which runs the SQLJ translator.
.sqlj
files, outputting translated .java
files.
.java
files.
For some VM and compiler configurations, however, the compiler invocation in step 3 will not return and your translation will suspend.
If you encounter this situation, the solution is to instruct SQLJ to run in two passes with the compilation step in between. To accomplish this, you must enable the -passes
flag as follows:
-passes
The -passes
option must be specified on the command line or, equivalently, in the SQLJ_OPTIONS
environment variable. It cannot be specified in a properties file.
With -passes
enabled, the following sequence occurs when you invoke the sqlj
script:
sqlj
script invokes your Java VM, which runs the SQLJ translator for its first pass.
.sqlj
files, outputting translated .java
files.
sqlj
script invokes the Java compiler, which compiles the .java
files.
sqlj
script invokes your Java VM again, which runs the SQLJ translator for its second pass.
With this sequence, you circumvent any problems the Java VM may have in invoking the Java compiler.
-passes
-passes
n/a
n/a
off
The following options relate to the customization of your SQLJ profiles:
Use the -default-customizer
option to instruct SQLJ to use a profile customizer other than the default, which is:
oracle.sqlj.runtime.util.OraCustomizer
In particular, use this option if you are not using an Oracle database.
This option takes a Java class name as its argument.
Note:
This option can be overridden using the |
-default-customizer=customizer_classname
-default-customizer=sqlj.myutil.MyCustomizer
sqlj.default-customizer=customizer_classname
sqlj.default-customizer=sqlj.myutil.MyCustomizer
oracle.sqlj.runtime.util.OraCustomizer
Note:
When you use an Oracle database, Oracle recommends that you use the default |
As with the VM and compiler, you can pass options directly to the profile customizer harness using a prefix, in this case -P
. This is discussed in "Options to Pass to Profile Customizer (-P)".
Details about these options, both general customization options and Oracle-specific customizer options, are covered in "Customization Options and Choosing a Customizer".