145.

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.2 JPublisher

< BACKCONTINUE >

B.2 JPublisher

JPublisher is a utility that automatically generates custom Java classes that correspond to database object types. These classes then enable SQLJ programs to access those database objects. The JPublisher utility may be invoked from the command line using the following syntax:

jpub -user=user_name/password -sql=database_object_types [option_list]

The syntax elements are as follows:

user_name

The database username.

password

The database password.

database_object_types

Specifies a comma-separated list of database object types for which JPublisher will generate class files. If the -sql option is not specified, class files for all object types contained in the specified schema are generated.

option_list

A list of options separated by space characters. Table B-2 lists the various JPublisher options, along with their descriptions and default values.

Table B-2. jpub options

Option

Description

Default value

-builtintypes

Specifies the set of type mappings to use for the non-numeric and non-LOB database columns when generating the custom Java classes. May be set to jdbc or oracle.

If set to jdbc (the default), then the database types CHAR, CHARACTER, LONG, STRING, VARCHAR, and VARCHAR2 are mapped to java.lang.String. RAW and LONG RAW are mapped to byte[]. DATE is mapped to java.sql.Timestamp.

If set to oracle, then CHAR, CHARACTER, LONG, STRING, VARCHAR, and VARCHAR2 are mapped to oracle.sql.CHAR. RAW and LONG RAW are mapped to oracle.sql.RAW. DATE is mapped to oracle.sql.DATE.

jdbc

-case

Specifies the case to use for Java identifiers generated by JPublisher. You may specify upper, same, or mixed.

mixed

-dir

Specifies the directory to which custom Java classes are written.

The current directory (in SQLJ 9i and above: empty)

-driver

Specifies the JDBC driver to use for the database connection.

oracle.jdbc.driver.OracleDriver

-encoding

Specifies the character set to use for the input and output files.

Value of the file.encoding system property

-input

Specifies the name of a file that contains a list of the object types and packages for which you want JPublisher to generate custom classes.

n/a

-lobtypes

Specifies the set of type mappings to use for the CLOB and BLOB database columns when generating the custom Java classes. May be set to oracle or jdbc.

If set to oracle (the default) then CLOB and BLOB are mapped to oracle.sql.CLOB and oracle.sql.BLOB respectively.

If set to jdbc, then CLOB and BLOB are mapped to java.sql.CLOB and java.sql.BLOB respectively.

oracle

-methods

Indicates whether Java wrapper methods are generated for the methods contained in the specified PL/SQL packages or object types. The most useful values for this option are none (may also use false) or all (may also use true).

all

-numbertypes

Specifies the type mappings to be used for numeric types. You may specify objectjdbc, jdbc, bigdecimal, or oracle.

If set to objectjdbc (the default), then the database SMALLINT is mapped to java.lang.Integer; REAL is mapped to java.lang.Float; DOUBLE PRECISION and FLOAT are mapped to java.lang.Double; and DEC, DECIMAL, NUMBER, and NUMERIC are mapped to java.math.BigDecimal. All the other numeric types are mapped to java.lang.Integer.

If set to jdbc, then the database SMALLINT is mapped to the Java short type; REAL is mapped to float; DOUBLE PRECISION and FLOAT are mapped to double; and DEC, DECIMAL, NUMBER, and NUMERIC are mapped to java.math.BigDecimal. All the other numeric types are mapped to int.

If set to bigdecimal, then all numeric database types are mapped to java.math.BigDecimal.

If set to oracle, then all numeric database types are mapped to oracle.sql.NUMBER.

objectjdbc

-omit_schema_names

Prevents JPublisher from making the schema name part of the class names that it generates for PL/SQL packages and Oracle8i object types.

Includes the schema names

-package

Specifies the name of a Java package that contains the custom class.

None

-props

Specifies the name of a file that contains JPublisher options. These options are then used in addition to those specified on the command line.

n/a

-url

Specifies the database URL.

jdbc:oracle:oci8:@

-usertypes

Specifies the set of type mappings to use for the variables contained in database object types. May be set to oracle or jdbc.

If set to oracle (the default), then JPublisher generates CustomDatum classes (ORAData in SQLJ 9i and above) for object, collection, and REF types.

If set to jdbc, then JPublisher generates SQLData classes for object types. You should use java.sql.Array for collections and java.sql.Ref for REF types.

oracle

The following example uses the JPublisher utility to generate a custom Java class for the database object type named t_address. The -user option is used to pass in a username and password. The -sql option is used to pass in the name of the object type:

jpub -user=object_user/object_password -sql=t_address

If you remove the -sql option from the command shown here, JPublisher generates class files for all types defined in the object_user schema.

< BACKCONTINUE >

Index terms contained in this section

jpub utility



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