Skip Headers
Oracle® Database SQLJ Developer's Guide and Reference
10g Release 2 (10.2)

Part Number B16018-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to next page
Next
View PDF

Contents

List of Examples

List of Tables

Title and Copyright Information

Send Us Your Comments

Preface

Intended Audience
Documentation Accessibility
Organization
Related Documentation
Conventions

1 Overview

1.1 Introduction to SQLJ
1.1.1 Basic Concepts
1.1.2 Oracle-Specific Code Generation Versus ISO Standard Code Generation
1.2 Overview of SQLJ Components
1.2.1 SQLJ Translator and SQLJ Run Time
1.2.2 SQLJ Profiles (ISO Standard Code)
1.2.2.1 Overview of Profiles
1.2.2.2 Binary Portability
1.3 Overview of Oracle Extensions to the SQLJ Standard
1.3.1 SQLJ Type Extensions
1.3.2 SQLJ Functionality Extensions
1.4 Basic Translation Steps and Run-Time Processing
1.4.1 SQLJ Translation Steps
1.4.2 Summary of Translator Input and Output
1.4.2.1 Translator Input
1.4.2.2 Translator Output
1.4.2.3 Output File Locations
1.4.3 SQLJ Run-Time Processing
1.4.3.1 Processing for Oracle-Specific Generated Code
1.4.3.2 Processing for ISO Standard Generated Code
1.5 JDBC Versus SQLJ Sample Code
1.5.1 JDBC Version of the Sample Code
1.5.2 SQLJ Version of the Sample Code
1.6 Alternative Deployment Scenarios
1.6.1 Running SQLJ in Applets
1.6.1.1 General Development and Deployment Considerations
1.6.1.2 General End User Considerations
1.6.1.3 Java Environment and the Java Plug-in
1.6.2 Introduction to SQLJ in the Server
1.7 Alternative Development Scenarios
1.7.1 SQLJ Globalization Support
1.7.2 SQLJ in Oracle JDeveloper 10g and Other IDEs
1.7.3 Windows Considerations

2 Getting Started

2.1 Assumptions and Requirements
2.1.1 Assumptions About Your Environment
2.1.2 Requirements for Using the Oracle SQLJ Implementation
2.1.3 SQLJ Environment: Key Scenarios and Guidelines
2.1.4 Environment Considerations
2.1.5 SQLJ Backward Compatibility
2.2 Checking the Installation and Configuration
2.2.1 Check for Availability of SQLJ and Demo Applications
2.2.2 Check for Installed Directories and Files
2.2.3 Set the Path and Classpath
2.2.4 Verify Installation of the sqljutl Package
2.3 Testing the Setup
2.3.1 Set Up the Run Time Connection
2.3.2 Create a Table to Verify the Database
2.3.3 Verify the JDBC Driver
2.3.4 Verify the SQLJ Translator and Run Time
2.3.5 Verify the SQLJ Translator Connection to the Database

3 Key Programming Considerations

3.1 Selection of the JDBC Driver
3.1.1 Overview of the Oracle JDBC Drivers
3.1.2 Driver Selection for Translation
3.1.3 Driver Selection and Registration for Run Time
3.2 Connection Considerations
3.2.1 Single Connection or Multiple Connections Using DefaultContext
3.2.2 Closing Connections
3.2.3 Multiple Connections Using Declared Connection Context Classes
3.2.4 More About the Oracle Class
3.2.5 More About the DefaultContext Class
3.2.6 Connection for Translation
3.2.7 Connection for Customization
3.3 NULL-Handling
3.3.1 Wrapper Classes for NULL-Handling
3.3.2 Examples of NULL-Handling
3.4 Exception-Handling Basics
3.4.1 SQLJ and JDBC Exception-Handling Requirements
3.4.2 Processing Exceptions
3.4.3 Using SQLException Subclasses
3.5 Basic Transaction Control
3.5.1 Overview of Transactions
3.5.2 Automatic Commits Versus Manual Commits
3.5.3 Specifying Auto-Commit as You Define a Connection
3.5.4 Modifying Auto-Commit in an Existing Connection
3.5.5 Using Manual COMMIT and ROLLBACK
3.5.6 Effect of Commits and Rollbacks on Iterators and Result Sets
3.5.7 Using Savepoints
3.6 Summary: First Steps in SQLJ Code
3.7 Oracle-Specific Code Generation (No Profiles)
3.7.1 Advantages and Disadvantages of Oracle-Specific Code Generation
3.7.2 Environment Requirements for Oracle-Specific Code Generation
3.7.3 Code Considerations and Limitations with Oracle-Specific Code Generation
3.7.4 SQLJ Usage Changes with Oracle-Specific Code Generation
3.7.5 Server-Side Considerations with Oracle-Specific Code Generation
3.8 Requirements and Restrictions for Naming
3.8.1 Java Namespace: Local Variable and Class Naming Restrictions
3.8.2 SQLJ Namespace
3.8.3 SQL Namespace
3.8.4 File Name Requirements and Restrictions
3.9 Considerations for SQLJ in the Middle Tier

4 Basic Language Features

4.1 Overview of SQLJ Declarations
4.1.1 Rules for SQLJ Declarations
4.1.2 Iterator Declarations
4.1.3 Connection Context Declarations
4.1.4 Declaration IMPLEMENTS Clause
4.1.5 Declaration WITH Clause
4.1.5.1 Standard WITH Clause Usage
4.1.5.2 Oracle-Specific WITH Clause Usage
4.1.5.3 Example: Returnability
4.2 Overview of SQLJ Executable Statements
4.2.1 Rules for SQLJ Executable Statements
4.2.2 SQLJ Clauses
4.2.3 Specifying Connection Context Instances and Execution Context Instances
4.2.4 Executable Statement Examples
4.2.5 PL/SQL Blocks in Executable Statements
4.3 Java Host, Context, and Result Expressions
4.3.1 Overview of Host Expressions
4.3.2 Basic Host Expression Syntax
4.3.3 Examples of Host Expressions
4.3.4 Overview of Result Expressions and Context Expressions
4.3.5 Evaluation of Java Expressions at Run Time
4.3.6 Examples of Evaluation of Java Expressions at Run Time (ISO Code Generation)
4.3.7 Restrictions on Host Expressions
4.4 Single-Row Query Results: SELECT INTO Statements
4.4.1 SELECT INTO Syntax
4.4.2 Examples of SELECT INTO Statements
4.4.3 Examples with Host Expressions in SELECT-List
4.4.4 SELECT INTO Error Conditions
4.5 Multirow Query Results: SQLJ Iterators
4.5.1 Iterator Concepts
4.5.1.1 Introduction to Strongly Typed Iterators
4.5.1.2 Introduction to Weakly Typed Iterators
4.5.2 General Steps in Using an Iterator
4.5.3 Named, Positional, and Result Set Iterators
4.5.4 Using Named Iterators
4.5.5 Using Positional Iterators
4.5.6 Using Iterators and Result Sets as Host Variables
4.5.7 Using Iterators and Result Sets as Iterator Columns
4.6 Assignment Statements (SET)
4.7 Stored Procedure and Function Calls
4.7.1 Calling Stored Procedures
4.7.2 Calling Stored Functions
4.7.3 Using Iterators and Result Sets as Stored Function Returns

5 Type Support

5.1 Supported Types for Host Expressions
5.1.1 Summary of Supported Types
5.1.2 Supported Types and Requirements for JDBC 2.0
5.1.3 Using PL/SQL BOOLEAN, RECORD Types, and TABLE Types
5.1.4 Backward Compatibility for Previous Oracle JDBC Releases
5.2 Support for Streams
5.2.1 General Use of SQLJ Streams
5.2.2 Key Aspects of Stream Support Classes
5.2.3 Using SQLJ Streams to Send Data
5.2.4 Retrieving Data into Streams: Precautions
5.2.5 Using SQLJ Streams to Retrieve Data
5.2.6 Stream Class Methods
5.2.7 Examples of Retrieving and Processing Stream Data
5.2.8 SQLJ Stream Objects as Output Parameters and Function Return Values
5.3 Support for JDBC 2.0 LOB Types and Oracle Type Extensions
5.3.1 Package oracle.sql
5.3.2 Support for BLOB, CLOB, and BFILE
5.3.3 Support for Oracle ROWID
5.3.4 Support for Oracle REF CURSOR Types
5.3.5 Support for Other Oracle Database 10g Data Types
5.3.6 Extended Support for BigDecimal

6 Objects, Collections, and OPAQUE Types

6.1 Oracle Objects and Collections
6.1.1 Introduction to Objects and Collections
6.1.2 Oracle Object Fundamentals
6.1.3 Oracle Collection Fundamentals
6.1.4 Object and Collection Data Types
6.2 Custom Java Classes
6.2.1 Custom Java Class Interface Specifications
6.2.2 Custom Java Class Support for Object Methods
6.2.3 Custom Java Class Requirements
6.2.4 Compiling Custom Java Classes
6.2.5 Reading and Writing Custom Data
6.2.6 Additional Uses for ORAData Implementations
6.3 User-Defined Types
6.4 JPublisher and the Creation of Custom Java Classes
6.4.1 What JPublisher Produces
6.4.2 Generating Custom Java Classes
6.4.3 JPublisher INPUT Files and Properties Files
6.4.4 Creating Custom Java Classes and Specifying Member Names
6.4.5 JPublisher Implementation of Wrapper Methods
6.4.6 JPublisher Custom Java Class Examples
6.4.7 Extending Classes Generated by JPublisher
6.5 Strongly Typed Objects and References in SQLJ Executable Statements
6.5.1 Selecting Objects and Object References into Iterator Columns
6.5.2 Updating an Object
6.5.3 Inserting an Object Created from Individual Object Attributes
6.5.4 Updating an Object Reference
6.6 Strongly Typed Collections in SQLJ Executable Statements
6.6.1 Accessing Nested Tables: TABLE syntax and CURSOR syntax
6.6.2 Inserting a Row that Includes a Nested Table
6.6.3 Selecting a Nested Table into a Host Expression
6.6.4 Manipulating a Nested Table Using TABLE Syntax
6.6.5 Selecting Data from a Nested Table Using a Nested Iterator
6.6.6 Selecting a VARRAY into a Host Expression
6.6.7 Inserting a Row that Includes a VARRAY
6.7 Serialized Java Objects
6.7.1 Serializing Java Classes to RAW and BLOB Columns
6.7.2 SerializableDatum: an ORAData Implementation
6.7.3 SerializableDatum in SQLJ Applications
6.7.4 SerializableDatum (Complete Class)
6.8 Weakly Typed Objects, References, and Collections
6.8.1 Support for Weakly Typed Objects, References, and Collections
6.8.2 Restrictions on Weakly Typed Objects, References, and Collections
6.9 Oracle OPAQUE Types

7 Advanced Language Features

7.1 Connection Contexts
7.1.1 Connection Context Concepts
7.1.2 Connection Context Logistics
7.1.3 More About Declaring and Using a Connection Context Class
7.1.4 Example of Multiple Connection Contexts
7.1.5 Implementation and Functionality of Connection Context Classes
7.1.6 Using the IMPLEMENTS Clause in Connection Context Declarations
7.1.7 Semantics-Checking of Your Connection Context Usage
7.1.8 Standard Data Source Support
7.1.9 SQLJ-Specific Data Sources
7.1.10 SQLJ-Specific Connection JavaBeans for JavaServer Pages
7.2 Execution Contexts
7.2.1 Relation of Execution Contexts to Connection Contexts
7.2.2 Creating and Specifying Execution Context Instances
7.2.3 Execution Context Synchronization
7.2.4 Execution Context Methods
7.2.4.1 Status Methods
7.2.4.2 Control Methods
7.2.4.3 Cancellation Method
7.2.4.4 Update Batching Methods
7.2.4.5 Savepoint Methods
7.2.4.6 Close Method
7.2.4.7 Example: Using ExecutionContext Methods
7.2.5 Relation of Execution Contexts to Multithreading
7.3 Multithreading in SQLJ
7.4 Iterator Class Implementation and Advanced Functionality
7.4.1 Implementation and Functionality of Iterator Classes
7.4.2 Using the IMPLEMENTS Clause in Iterator Declarations
7.4.3 Support for Extending Iterator Classes
7.4.4 Result Set Iterators
7.4.5 Scrollable Iterators
7.5 Advanced Transaction Control
7.5.1 SET TRANSACTION Syntax
7.5.2 Access Mode Settings
7.5.3 Isolation Level Settings
7.5.4 Using JDBC Connection Class Methods
7.6 SQLJ and JDBC Interoperability
7.6.1 SQLJ Connection Context and JDBC Connection Interoperability
7.6.2 SQLJ Iterator and JDBC Result Set Interoperability
7.7 Support for Dynamic SQL
7.7.1 Meta Bind Expressions
7.7.2 SQLJ Dynamic SQL Examples

8 Translator Command Line and Options

8.1 Translator Command Line and Properties Files
8.1.1 SQLJ Options, Flags, and Prefixes
8.1.2 Command-Line Syntax and Operations
8.1.3 Properties Files for Option Settings
8.1.4 SQLJ_OPTIONS Environment Variable for Option Settings
8.1.5 Order of Precedence of Option Settings
8.2 Basic Translator Options
8.2.1 Basic Options for the Command Line Only
8.2.2 Options for Output Files and Directories
8.2.3 Connection Options
8.2.4 Options for Reporting and Line-Mapping
8.2.5 Options for DMS
8.2.6 Options for Code Generation, Optimizations, and CHAR Comparisons
8.3 Advanced Translator Options
8.3.1 Prefixes that Pass Option Settings to Other Executables
8.3.2 Flags for Special Processing
8.3.3 Semantics-Checking and Offline-Parsing Options
8.4 Translator Support and Options for Alternative Environments
8.4.1 Java and Compiler Options
8.4.2 Customization Options

9 Translator and Run Time Functionality

9.1 Internal Translator Operations
9.1.1 Java and SQLJ Code-Parsing and Syntax-Checking
9.1.2 SQL Semantics-Checking and Offline Parsing
9.1.3 Code Generation
9.1.4 Java Compilation
9.1.5 Profile Customization (ISO Code Generation)
9.2 Functionality of Translator Errors, Messages, and Exit Codes
9.2.1 Translator Error, Warning, and Information Messages
9.2.2 Translator Status Messages
9.2.3 Translator Exit Codes
9.3 SQLJ Run Time
9.3.1 SQLJ Run Time Packages
9.3.2 Categories of Run-Time Errors
9.4 Globalization Support in the Translator and Run Time
9.4.1 Character Encoding and Language Support
9.4.2 SQLJ and Java Settings for Character Encoding and Language Support
9.4.3 SQLJ Extended Globalization Support
9.4.4 Manipulation Outside of SQLJ for Globalization Support

10 Performance and Debugging

10.1 Performance Enhancement Features
10.1.1 Row Prefetching
10.1.2 Statement Caching
10.1.3 Update Batching
10.1.4 Column Definitions
10.1.5 Parameter Size Definitions
10.2 SQLJ Debugging Features
10.2.1 SQLJ -linemap Flag for Debugging
10.2.2 Server-Side debug Option
10.2.3 Introduction to the AuditorInstaller Specialized Customizer
10.2.4 Introduction to Developing and Debugging in Oracle10g JDeveloper
10.3 SQLJ Support for Oracle Performance Monitoring
10.3.1 Overview of SQLJ DMS Support
10.3.2 Summary of SQLJ Command-Line Options for DMS
10.3.3 SQLJ Run Time Commands and Properties File Settings for DMS
10.3.4 SQLJ DMS Sensors and Metrics
10.3.5 SQLJ DMS Examples

11 SQLJ in the Server

11.1 Introduction to Server-Side SQLJ
11.2 Creating SQLJ Code for Use in the Server
11.2.1 Database Connections Within the Server
11.2.2 Coding Issues Within the Server
11.2.3 Default Output Device in the Server
11.2.4 Name Resolution in the Server
11.2.5 SQL Names Versus Java Names
11.3 Translating SQLJ Source on a Client and Loading Components
11.3.1 Loading Classes and Resources into the Server
11.3.2 Naming of Loaded Class and Resource Schema Objects
11.3.3 Publishing the Application After Loading Class and Resource Files
11.3.4 Summary: Running a Client Application in the Server
11.4 Loading SQLJ Source and Translating in the Server
11.4.1 Loading SQLJ Source Code into the Server
11.4.2 Option Support in the Server Embedded Translator
11.4.3 Naming of Loaded Source and Generated Class and Resource Schema Objects
11.4.4 Error Output from the Server Embedded Translator
11.4.5 Publishing the Application After Loading Source Files
11.5 Dropping Java Schema Objects
11.6 Additional Server-Side Considerations
11.6.1 Java Multithreading in the Server
11.6.2 Recursive SQLJ Calls in the Server
11.6.3 Verifying that Code is Running in the Server

A Customization and Specialized Customizers

A.1 More About Profiles
A.1.1 Creation of a Profile During Code Generation
A.1.2 Sample Profile Entry
A.1.2.1 SQLJ Executable Statement
A.1.2.2 Corresponding SQLJ Profile Entry
A.2 More About Profile Customization
A.2.1 Overview of the Customizer Harness and Customizers
A.2.2 Steps in the Customization Process
A.2.3 Creation and Registration of a Profile Customization
A.2.4 Customization Error and Status Messages
A.2.5 Functionality of a Customized Profile at Run Time
A.3 Customization Options and Choosing a Customizer
A.3.1 Overview of Customizer Harness Options
A.3.1.1 Syntax for Customizer Harness Options
A.3.1.2 Options Supported by the Customizer Harness
A.3.2 General Customizer Harness Options
A.3.2.1 Profile Backup Option (backup)
A.3.2.2 Customization Connection Context Option (context)
A.3.2.3 Customizer Option (customizer)
A.3.2.4 Customization JAR File Digests Option (digests)
A.3.2.5 Customization Help Option (help)
A.3.2.6 Customization Verbose Option (verbose)
A.3.3 Customizer Harness Options for Connections
A.3.3.1 Customization User Option (user)
A.3.3.2 Customization Password Option (password)
A.3.3.3 Customization URL Option (url)
A.3.3.4 Customization JDBC Driver Option (driver)
A.3.4 Customizer Harness Options that Invoke Specialized Customizers
A.3.4.1 Specialized Customizer: Profile Debug Option (debug)
A.3.4.2 Specialized Customizer: Profile Print Option (print)
A.3.4.3 Specialized Customizer: Profile Semantics-Checking Option (verify)
A.3.5 Overview of Customizer-Specific Options
A.3.6 Oracle Customizer Options
A.3.6.1 Options Supported by the Oracle Customizer
A.3.6.2 Oracle Customizer Version Compatibility Option (compat)
A.3.6.3 Oracle Customizer Force Option (force)
A.3.6.4 Oracle Customizer Column Definition Option (optcols)
A.3.6.5 Oracle Customizer Parameter Definition Option (optparams)
A.3.6.6 Oracle Customizer Parameter Default Size Option (optparamdefaults)
A.3.6.7 Oracle Customizer CHAR Comparisons with Blank Padding (fixedchar)
A.3.6.8 Oracle Customizer Show-SQL Option (showSQL)
A.3.6.9 Oracle Customizer Statement Cache Size Option (stmtcache)
A.3.6.10 Oracle Customizer Summary Option (summary)
A.3.7 Options for Other Customizers
A.3.8 SQLJ Translator Options for Profile Customization
A.4 JAR Files for Profiles
A.4.1 JAR File Requirements
A.4.2 JAR File Logistics
A.5 SQLCheckerCustomizer for Profile Semantics-Checking
A.5.1 Invoking SQLCheckerCustomizer with the Customizer Harness verify Option
A.5.1.1 Command-line syntax
A.5.1.2 Command-line example
A.5.1.3 Properties file syntax
A.5.1.4 Properties file example
A.5.1.5 Default value
A.5.2 SQLCheckerCustomizer Options
A.5.2.1 SQLCheckerCustomizer Semantics-Checker Option (checker)
A.5.2.2 SQLCheckerCustomizer Warnings Option (warn)
A.6 AuditorInstaller Customizer for Debugging
A.6.1 Overview of Auditors and Code Layers
A.6.2 Invoking AuditorInstaller with the Customizer Harness debug Option
A.6.2.1 Command-line syntax
A.6.2.2 Command-line example
A.6.2.3 Properties file syntax
A.6.2.4 Properties file example
A.6.2.5 Default value
A.6.3 AuditorInstaller Run Time Output
A.6.4 AuditorInstaller Options
A.6.4.1 AuditorInstaller Depth Option (depth)
A.6.4.2 AuditorInstaller Log File Option (log)
A.6.4.3 AuditorInstaller Prefix Option (prefix)
A.6.4.4 AuditorInstaller Return Arguments Option (showReturns)
A.6.4.5 AuditorInstaller Thread Names Option (showThreads)
A.6.4.6 AuditorInstaller Uninstall Option (uninstall)
A.6.5 Full Command-Line Examples

Index