| Oracle8i SQLJ Developer's Guide and Reference Release 2 (8.1.6) A81360-01 |
|
By default, release 8.1.6 of Oracle SQLJ is configured to run under the Sun Microsystems JDK 1.2.x and to use the Sun Microsystems compiler javac. These are not requirements, however. You can configure SQLJ to work with alternative JVMs or compilers. To do so, you must supply SQLJ with the following information:
-vm option)
-compiler-executable option)
A set of SQLJ options allows 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". "Basic Translator Options" describes more basic flags and options.
The following options relate to the operation of the JVM and Java compiler:
-vm (specify the JVM; command-line only)
-compiler-executable (specify the Java compiler)
-compiler-encoding-flag
-compiler-output-file
-compiler-pipe-output-flag
Some compilers, such as the standard javac, require a Java source file name to match the name of the public class (if any) defined there. Therefore, by default the SQLJ translator verifies that this is true. You can use the following option, however, to instruct SQLJ not to verify this:
For some JVM and compiler configurations, there might be problems with the way SQLJ normally invokes the compiler. You can use the following option to alleviate this by breaking SQLJ processing into a two-pass process:
You can also pass options directly to the particular JVM 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 JVM 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 JVM is invoked.
If you do not specify a directory path along with the name of the JVM executable file, then SQLJ looks for the executable according to the PATH setting of your operating system.
|
Note:
Special functionality of this option, |
-vm=JVM_path+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 required 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.
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.
|
Note:
If you use a compiler that does not support an |
-compiler-executable=Java_compiler_path+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 is aware of the file name. Otherwise SQLJ assumes that the compiler outputs to the standard output device (such as STDOUT on a UNIX system). As appropriate, specify an absolute path, or a relative path from the current directory.
-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 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
This flag instructs SQLJ whether to verify that the SQLJ source file name matches the name of the public class (if any) defined there. Some compilers, such as the standard javac, require this to be the case; others do not.
To maximize portability of your code, this flag should be enabled, which it is by default.
(It is advisable for the source file name to always match the name of the public class defined, or, if there is no public class, then the name of the first class defined. For example, public class MyPublicClass should be defined in a MyPublicClass.sqlj source file.)
-checkfilename=true/false
-checkfilename=false
sqlj.checkfilename=true/false
sqlj.checkfilename=false
true
By default, the following sequence occurs when you invoke the sqlj script:
sqlj script invokes your JVM, which runs the SQLJ translator.
.sqlj files, generating translated .java files.
.java files.
For some JVM 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 JVM, which runs the SQLJ translator for its first pass.
.sqlj files, generating translated .java files.
sqlj script invokes the Java compiler, which compiles the generated .java files.
sqlj script invokes your JVM again, which runs the SQLJ translator for its second pass.
With this sequence, you circumvent any problems the JVM might 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 fully qualified Java class name as its argument.
|
Notes:
You can override this option with 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
As with the JVM 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 the 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".