144.

var PrxLC=new Date(0);var PrxModAtr=0;var PrxInst; if(!PrxInst++) PrxRealOpen=window.open;function PrxOMUp(){PrxLC=new Date();}function PrxNW(){return(this.window);} function PrxOpen(url,nam,atr){ if(PrxLC){ var cdt=new Date(); cdt.setTime(cdt.getTime()-PrxLC.getTime()); if(cdt.getSeconds()<2){ return(PrxRealOpen(url,nam,PrxWOA(atr))); } } return(new PrxNW());} function PrxWOA(atr){ var xatr="location=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes"; if(!PrxModAtr) return(atr); if(atr){ var hm; hm=atr.match(/height=[0-9]+/i); if(hm) xatr+="," + hm; hm=atr.match(/width=[0-9]+/i); if(hm) xatr+="," + hm; } return(xatr);}window.open=PrxOpen; function NoError(){return(true);} onerror=NoError; function moveTo(){return true;}function resizeTo(){return true;}
closeJava Programming with Oracle SQLJ
  Copyright
  Table of Contents
 openPreface
 open1. Introduction
 open2. Relational Databases, SQL, and PL/SQL
 open3. Fundamental SQLJ Programming
 open4. Database Objects
 open5. Collections
 open6. Deploying SQLJ in the JServer
 open7. Large Objects
 open8. Contexts and Multithreading
 open9. Advanced Transaction Control
 open10. Performance Tuning
 open11. Combining JDBC, SQLJ, and Dynamic SQL
 openA. Java and Oracle Type Mappings
 closeB. Oracle Java Utilities Reference
  B.1 Oracle SQLJ Translator
   B.2 JPublisher
   B.3 loadjava
   B.4 dropjava
   B.5 deployejb
 openC. SQLJ in Applets, Servlets, and JavaServer Pages
  Colophon
  Index

Database > Java Programming with Oracle SQLJ > B. Oracle Java Utilities Reference > B.1 Oracle SQLJ Translator

< BACKCONTINUE >

B.1 Oracle SQLJ Translator

The Oracle SQLJ translator, sqlj, translates a SQLJ file to a Java source file (with an extension of .java) and then compiles that Java source file into a Java class file (with an extension of .class). You invoke sqlj from the command line using the following syntax:

sqlj [option_list] file_list

The syntax elements are as follows:

option_list

A list of options separated by space characters. See Table B-1 for a list of valid options.

file_list

The list of files that you wish to translate and compile. You must separate the filenames in the list using spaces.

Table B-1 lists the sqlj command-line options, along with their descriptions and default values. The flags are case-insensitive; for example, to use the -cache flag you can specify the following: -cache=false. After the table, I show some examples of sqlj invocations.

Table B-1. sqlj options

Option

Description

Default value

-cache

Enables caching of the results of online semantics checking. This is a TRUE/FALSE flag.

False

-checkfilename

Indicates whether a warning is to be displayed when a source file name does not correspond to the name of the public class defined within that source file. This is a TRUE/FALSE flag.

True

-checksource

Enables SQLJ type resolution, which causes SQLJ to examine source files in addition to class files. This is a TRUE/FALSE flag.

True

-classpath

Specifies the Java CLASSPATH that is to be passed to the JVM and Java compiler.

None

-compile

Indicates whether the .java file produced by sqlj should also be compiled. This is a TRUE/FALSE flag.

True

-compiler-executable

Specifies the executable name of the Java compiler to use during compilation.

javac

-compiler-output-file

Specifies a file to which the output from the Java compiler is to be written. By default, the output from the Java compiler is displayed on the screen.

None

-Coption

Specifies an option to be passed to the Java compiler.

n/a

-d

Specifies the directory where the .ser and .class files are to be placed.

Empty

-default-customizer

Specifies the class name for the profile customizer.

oracle.sqlj.runtime.util.OraCustomizer

-default-url-prefix

Specifies the default prefix for database URL strings.

jdbc:oracle:thin:

-dir

Specifies the directory in which SQLJ should place the .java files that it generates.

Empty

-driver

Specifies the class name of the JDBC driver to use.

oracle.jdbc.driver.OracleDriver

-explain

Enables the display of detailed information for error messages. This is a TRUE/FALSE flag.

False

-g

Causes the Java compiler to generate debugging code.

n/a

-help

Displays the list of options that may be used with sqlj.

n/a

-Joption

Specifies an option to be passed to the Java Virtual Machine (JVM).

n/a

-linemap

Enables the mapping of line numbers between SQLJ code and the generated Java class file. This is a TRUE/FALSE flag.

False

-n

Causes SQLJ to echo the entire command line rather than executing it. This is a TRUE/FALSE flag.

n/a

-nowarn

Causes SQLJ to set the -warn Java compiler option to none.

n/a

-O

Causes SQLJ to disable the Java compiler's -linemap option.

n/a

-online

Specifies the class name of the online SQL checker to be used. You must also use the -user and -password options when using this option, so that you can pass in your database username and password to connect to the database.

oracle.sqlj.checker.OracleChecker

-Poption

Specifies an option to be passed to the SQLJ profile customizer.

n/a

-password

Specifies the password to use when connecting to the database to do online semantics checking. Use the -user option to specify the username.

None

-profile

Enables the profile customization step. This is a TRUE/FALSE flag.

True

-props

Specifies a properties file that contains command-line properties.

None

-ser2class

Enables translation of generated .ser profiles to .class files. This is a TRUE/FALSE flag.

False

-status

Enables the display of status messages. This is a TRUE/FALSE flag.

False

-url

Specifies the database URL to use for online semantics checking.

jdbc:oracle:oci8:@

-user

Specifies the database user to use when connecting to the database to perform online semantics checking of your embedded SQL statements.

None

-verbose

Causes SQLJ to display detailed information regarding the translation and compilation. Also enables the -status option of the Java compiler.

n/a

-version

Causes SQLJ to display the version of SQLJ used.

n/a

-version-long

Causes SQLJ to display more detailed version information, such as the version of JDBC and Java used.

n/a

-warn

Specifies a list of comma-separated flags that enable or disable various SQLJ warnings.

The individual flags that you can use with -warn are as follows:

  • precision/noprecision

  • nulls/nonulls

  • portable/noportable

  • strict/nostrict

  • verbose/noverbose

  • all/none

The all and none flags are global in nature. They respectively enable and disable all warnings.

precision, nulls, noportable, strict, noverbose

The following command uses sqlj to translate and compile the HelloWorld.sqlj file:

sqlj HelloWorld.sqlj

The following command also uses sqlj to translate and compile the HelloWorld.sqlj file. During compilation, because the -user option is used, sqlj will connect to the fundamental_user schema to check that the SQL statements used in the HelloWorld.sqlj program are correct:

sqlj -user fundamental_user -password fundamental_password  HelloWorld.sqlj

Alternately, the following command does the same thing:

sqlj -user=fundamental_user/fundamental_password HelloWorld.sqlj
< BACKCONTINUE >

Index terms contained in this section

sqlj utility
      options, listed



Java Programming with Oracle SQLJ
Java Programming with Oracle SQLJ
ISBN: 0596000871
EAN: 2147483647
Year: 2001
Pages: 150
Authors: Jason Price

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net