Skip Headers

Oracle® Database JDBC Developer's Guide and Reference
10g Release 1 (10.1)

Part Number B10979-02
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

Title and Copyright Information

Send Us Your Comments

Preface

Intended Audience
Documentation Accessibility
Structure
Related Documents
Conventions

1 Overview

1.1 What is JDBC?
1.2 Overview of the Oracle JDBC Drivers
1.2.1 Common Features of Oracle JDBC Drivers
1.2.2 JDBC Thin Driver
1.2.3 JDBC OCI Driver
1.2.4 JDBC Server-Side Thin Driver
1.2.4.1 About Permission for the Server-Side Thin Driver
1.2.5 JDBC Server-Side Internal Driver
1.2.6 Choosing the Appropriate Driver
1.3 Overview of Application and Applet Functionality
1.3.1 Applet Basics
1.3.1.1 Applets and Security
1.3.1.2 Applets and Firewalls
1.3.1.3 Packaging and Deploying Applets
1.3.2 Oracle Extensions
1.4 Server-Side Basics
1.4.1 Session and Transaction Context
1.4.2 Connecting to the Database
1.5 Environments and Support
1.5.1 Supported JDK and JDBC Versions
1.5.1.1 Backward Compatibility
1.5.1.2 Forward Compatibility
1.5.2 JNI and Java Environments
1.5.3 JDBC and IDEs
1.6 Changes At This Release
1.6.1 New Features
1.6.2 Deprecated Features
1.6.3 Desupported Features
1.6.4 Interface Changes

2 Getting Started

2.1 Compatibilities for Oracle JDBC Drivers
2.1.1 Backward Compatibility
2.1.2 Forward Compatibility
2.2 Verifying a JDBC Client Installation
2.2.1 Check Installed Directories and Files
2.2.2 Check the Environment Variables
2.2.2.1 JDBC OCI Driver
2.2.2.2 JDBC Thin Driver
2.2.3 Make Sure You Can Compile and Run Java
2.2.4 Determine the Version of the JDBC Driver
2.2.5 Testing JDBC and the Database Connection: JdbcCheckup

3 Datasources and URLs

3.1 Datasources
3.1.1 A Brief Overview of Oracle Datasource Support for JNDI
3.1.2 Datasource Features and Properties
3.1.2.1 DataSource Interface and Oracle Implementation
3.1.2.2 DataSource Properties
3.1.3 Creating a Datasource Instance and Connecting (without JNDI)
3.1.4 Creating a Datasource Instance, Registering with JNDI, and Connecting
3.1.4.1 Initialize Connection Properties
3.1.4.2 Register the Datasource
3.1.4.3 Open a Connection
3.1.5 Logging and Tracing
3.2 Database URLs and Database Specifiers
3.2.1 Database Specifiers
3.2.1.1 Thin-style Service Name Syntax
3.2.1.2 TNSNames Alias Syntax

4 Basic Features

4.1 First Steps in JDBC
4.1.1 Importing Packages
4.1.2 Opening a Connection to a Database
4.1.2.1 Specifying a Database URL, User Name, and Password
4.1.2.2 Specifying a Database URL That Includes User Name and Password
4.1.2.3 Supported Connection Properties
4.1.2.4 Using Roles for Sys Logon
4.1.2.5 Bequeath Connection and Sys Logon
4.1.2.6 Remote Connection
4.1.2.7 Properties for Oracle Performance Extensions
4.1.3 Creating a Statement Object
4.1.4 Executing a Query and Returning a Result Set Object
4.1.5 Processing the Result Set
4.1.6 Closing the Result Set and Statement Objects
4.1.7 Making Changes to the Database
4.1.8 Committing Changes
4.1.9 Closing the Connection
4.2 Sample: Connecting, Querying, and Processing the Results
4.3 Datatype Mappings
4.3.1 Table of Mappings
4.3.2 Notes Regarding Mappings
4.3.2.1 Regarding User-Defined Types
4.3.2.2 Regarding NUMBER Types
4.4 Java Streams in JDBC
4.4.1 Streaming LONG or LONG RAW Columns
4.4.1.1 LONG RAW Data Conversions
4.4.1.2 LONG Data Conversions
4.4.1.3 Streaming Example for LONG RAW Data
4.4.1.4 Avoiding Streaming for LONG or LONG RAW
4.4.2 Streaming CHAR, VARCHAR, or RAW Columns
4.4.3 Data Streaming and Multiple Columns
4.4.3.1 Streaming Example with Multiple Columns
4.4.3.2 Bypassing Streaming Data Columns
4.4.4 Streaming LOBs and External Files
4.4.4.1 Streaming BLOBs and CLOBs
4.4.4.2 Streaming BFILEs
4.4.5 Closing a Stream
4.4.6 Notes and Precautions on Streams
4.4.6.1 Streaming Data Precautions
4.4.6.2 Using Streams to Avoid Limits on setBytes() and setString()
4.4.6.3 Streaming and Row Prefetching
4.5 Stored Procedure Calls in JDBC Programs
4.5.1 PL/SQL Stored Procedures
4.5.2 Java Stored Procedures
4.6 Processing SQL Exceptions
4.6.1 Retrieving Error Information
4.6.2 Printing the Stack Trace

5 JDBC Standards Support

5.1 Introduction
5.2 JDBC 2.0 Support: JDK 1.2.x and Higher Versions
5.2.1 Datatype Support
5.2.2 Standard Feature Support
5.2.3 Extended Feature Support
5.2.4 Standard versus Oracle Performance Enhancement APIs
5.2.5 Migration from JDK 1.1.x
5.3 JDBC 3.0 Support: JDK 1.4 and Previous Releases
5.4 Overview of Supported JDBC 3.0 Features
5.4.1 Unsupported JDBC 3.0 Features
5.5 Transaction Savepoints
5.5.1 Creating a Savepoint
5.5.2 Rolling back to a Savepoint
5.5.3 Releasing a Savepoint
5.5.4 Checking Savepoint Support
5.5.5 Savepoint Notes
5.5.6 Savepoint Interfaces
5.5.7 Pre-JDK1.4 Savepoint Support
5.6 JDBC 3.0 LOB Interface Methods

6 Statement Caching

6.1 About Statement Caching
6.1.1 Basics of Statement Caching
6.1.2 Implicit Statement Caching
6.1.3 Explicit Statement Caching
6.2 Using Statement Caching
6.2.1 Enabling and Disabling Statement Caching
6.2.1.1 Enabling and Disabling Implicit Statement Caching
6.2.1.2 Enabling and Disabling Explicit Statement Caching
6.2.2 Checking for Statement Creation Status
6.2.3 Physically Closing a Cached Statement
6.2.4 Using Implicit Statement Caching
6.2.4.1 Allocating a Statement for Implicit Caching
6.2.4.2 Disabling Implicit Statement Caching for a Particular Statement
6.2.4.3 Implicitly Caching a Statement
6.2.4.4 Retrieving an Implicitly Cached Statement
6.2.5 Using Explicit Statement Caching
6.2.5.1 Allocating a Statement for Explicit Caching
6.2.5.2 Explicitly Caching a Statement
6.2.5.3 Retrieving an Explicitly Cached Statement

7 Implicit Connection Caching

7.1 The Implicit Connection Cache
7.2 Using the Connection Cache
7.2.1 Turning Caching On
7.2.2 Opening a Connection
7.2.3 Setting Connection Cache Name
7.2.4 Setting Connection Cache Properties
7.2.5 Closing A Connection
7.2.6 Implicit Connection Cache Example
7.3 Connection Attributes
7.3.1 Getting Connections
7.3.1.1 Attribute Matching Rules
7.3.2 Setting Connection Attributes
7.3.3 Checking a Returned Connection's Attributes
7.3.4 Connection Attribute Example
7.4 Connection Cache Properties
7.4.1 Limit Properties
7.4.1.1 InitialLimit
7.4.1.2 MaxLimit
7.4.1.3 MaxStatementsLimit
7.4.1.4 MinLimit
7.4.2 Timeout Properties
7.4.2.1 InactivityTimeout
7.4.2.2 TimeToLiveTimeout
7.4.2.3 AbandonedConnectionTimeout
7.4.2.4 PropertyCheckInterval
7.4.3 Other Properties
7.4.3.1 AttributeWeights
7.4.3.2 ClosestConnectionMatch
7.4.3.3 ConnectionWaitTimeout
7.4.3.4 LowerThresholdLimit
7.4.3.5 ValidateConnection
7.4.4 Connection Property Example
7.5 Connection Cache Manager API
7.5.1 createCache
7.5.2 removeCache
7.5.3 reinitializeCache
7.5.4 existsCache
7.5.5 enableCache
7.5.6 disableCache
7.5.7 refreshCache
7.5.8 purgeCache
7.5.9 getCacheProperties
7.5.10 getCacheNameList
7.5.11 getNumberOfAvailableConnections
7.5.12 getNumberOfActiveConnections
7.5.13 setConnectionPoolDataSource
7.5.14 Example Of ConnectionCacheManager Use
7.6 Advanced Topics
7.6.1 Attribute Weights And Connection Matching
7.6.1.1 ClosestConnectionMatch
7.6.1.2 AttributeWeights
7.6.2 Connection Cache Callbacks

8 Fast Connection Failover

8.1 Introduction
8.1.1 What Can Fast Connection Failover Do?
8.2 Using Fast Connection Failover
8.2.1 Fast Connection Failover Prerequisites
8.2.2 Configuring ONS For Fast Connection Failover
8.2.2.1 ONS Configuration File
8.2.2.2 Client-side ONS Configuration
8.2.2.3 Server-side ONS Configuration Using racgons
8.2.3 Enabling Fast Connection Failover
8.2.4 Querying Fast Connection Failover Status
8.3 Understanding Fast Connection Failover
8.3.1 What The Application Sees
8.3.2 What's Happening
8.4 Comparison of Fast Connection Failover and TAF

9 Distributed Transactions

9.1 Overview
9.1.1 Distributed Transaction Components and Scenarios
9.1.2 Distributed Transaction Concepts
9.1.3 Switching Between Global and Local Transactions
9.1.3.1 Mode Restrictions On Operations
9.1.4 Oracle XA Packages
9.2 XA Components
9.2.1 XA Datasource Interface and Oracle Implementation
9.2.2 XA Connection Interface and Oracle Implementation
9.2.3 XA Resource Interface and Oracle Implementation
9.2.4 XA Resource Method Functionality and Input Parameters
9.2.4.1 Start
9.2.4.2 End
9.2.4.3 Prepare
9.2.4.4 Commit
9.2.4.5 Roll back
9.2.4.6 Forget
9.2.4.7 Recover
9.2.4.8 Check for same RM
9.2.5 XA ID Interface and Oracle Implementation
9.3 Error Handling and Optimizations
9.3.1 XA Exception Classes and Methods
9.3.2 Mapping between Oracle Errors and XA Errors
9.3.3 XA Error Handling
9.3.4 Oracle XA Optimizations
9.4 Implementing a Distributed Transaction
9.4.1 Summary of Imports for Oracle XA
9.4.2 Oracle XA Code Sample

10 Oracle Extensions

10.1 Introduction to Oracle Extensions
10.2 Support Features of the Oracle Extensions
10.2.1 Support for Oracle Datatypes
10.2.2 Support for Oracle Objects
10.2.3 Support for Schema Naming
10.2.4 OCI Extensions
10.3 Oracle JDBC Packages and Classes
10.3.1 Package oracle.sql
10.3.1.1 Classes of the oracle.sql Package
10.3.1.2 General oracle.sql.* Datatype Support
10.3.1.3 Overview of Class oracle.sql.STRUCT
10.3.1.4 Overview of Class oracle.sql.REF
10.3.1.5 Overview of Class oracle.sql.ARRAY
10.3.1.6 Overview of Classes oracle.sql.BLOB, oracle.sql.CLOB, oracle.sql.BFILE
10.3.1.7 Classes oracle.sql.DATE, oracle.sql.NUMBER, and oracle.sql.RAW
10.3.1.8 Classes oracle.sql.TIMESTAMP, oracle.sql.TIMESTAMPTZ, and oracle.sql.TIMESTAMPLTZ
10.3.1.9 Overview of Class oracle.sql.ROWID
10.3.1.10 Class oracle.sql.OPAQUE
10.3.2 Package oracle.jdbc
10.3.2.1 Interface oracle.jdbc.OracleConnection
10.3.2.2 Interface oracle.jdbc.OracleStatement
10.3.2.3 Interface oracle.jdbc.OraclePreparedStatement
10.3.2.4 Interface oracle.jdbc.OracleCallableStatement
10.3.2.5 Interface oracle.jdbc.OracleResultSet
10.3.2.6 Interface oracle.jdbc.OracleResultSetMetaData
10.3.2.7 Class oracle.jdbc.OracleTypes
10.3.2.8 Method getJavaSqlConnection()
10.4 Oracle Character Datatypes Support
10.4.1 SQL CHAR Datatypes
10.4.2 SQL NCHAR Datatypes
10.4.3 Class oracle.sql.CHAR
10.4.3.1 oracle.sql.CHAR Objects and Character Sets
10.4.3.2 Constructing an oracle.sql.CHAR Object
10.4.3.3 oracle.sql.CHAR Conversion Methods
10.5 Additional Oracle Type Extensions
10.5.1 Oracle ROWID Type
10.5.1.1 Example: ROWID
10.5.2 Oracle REF CURSOR Type Category
10.5.2.1 Example: Accessing REF CURSOR Data

11 Accessing and Manipulating Oracle Data

11.1 Data Conversion Considerations
11.1.1 Standard Types Versus Oracle Types
11.1.2 Converting SQL NULL Data
11.1.3 Testing for NULLs
11.2 Result Set and Statement Extensions
11.3 Comparison of Oracle get and set Methods to Standard JDBC
11.3.1 Standard getObject() Method
11.3.2 Oracle getOracleObject() Method
11.3.2.1 Example: Using getOracleObject() with a ResultSet
11.3.2.2 Example: Using getOracleObject() in a Callable Statement
11.3.3 Summary of getObject() and getOracleObject() Return Types
11.3.4 Other getXXX() Methods
11.3.4.1 Return Types of getXXX() Methods
11.3.4.2 Special Notes about getXXX() Methods
11.3.5 Datatypes For Returned Objects from getObject and getXXX
11.3.5.1 Example: Casting Return Values
11.3.6 The setObject() and setOracleObject() Methods
11.3.6.1 Example: Using setObject() and setOracleObject()
11.3.7 Other setXXX() Methods
11.3.7.1 Input Parameter Types of setXXX() Methods
11.3.7.2 Setter Method Size Limitations
11.3.7.3 Setter Methods That Take Additional Input
11.3.7.4 Method setFixedCHAR() for Binding CHAR Data into WHERE Clauses
11.4 Using Result Set Meta Data Extensions

12 Globalization Support

12.1 Providing Globalization Support
12.1.1 Compressing ora18n.jar
12.2 NCHAR, NVARCHAR2, NCLOB and the defaultNChar Property
12.3 JDBC Methods Dependent On Conversion

13 Working with Oracle Object Types

13.1 Mapping Oracle Objects
13.2 Using the Default STRUCT Class for Oracle Objects
13.2.1 STRUCT Class Functionality
13.2.1.1 Standard java.sql.Struct Methods
13.2.1.2 Oracle oracle.sql.STRUCT Class Methods
13.2.1.3 STRUCT Descriptors
13.2.2 Creating STRUCT Objects and Descriptors
13.2.2.1 Steps in Creating StructDescriptor and STRUCT Objects
13.2.2.2 Using StructDescriptor Methods
13.2.2.3 Serializable STRUCT Descriptors
13.2.3 Retrieving STRUCT Objects and Attributes
13.2.3.1 Retrieving an Oracle Object as an oracle.sql.STRUCT Object
13.2.3.2 Retrieving an Oracle Object as a java.sql.Struct Object
13.2.3.3 Retrieving Attributes as oracle.sql Types
13.2.3.4 Retrieving Attributes as Standard Java Types
13.2.4 Binding STRUCT Objects into Statements
13.2.5 STRUCT Automatic Attribute Buffering
13.3 Creating and Using Custom Object Classes for Oracle Objects
13.3.1 Relative Advantages of ORAData versus SQLData
13.3.2 Understanding Type Maps for SQLData Implementations
13.3.3 Creating a Type Map Object and Defining Mappings for a SQLData Implementation
13.3.3.1 Adding Entries to an Existing Type Map
13.3.3.2 Creating a New Type Map
13.3.3.3 Materializing Object Types not Specified in the Type File
13.3.4 Understanding the SQLData Interface
13.3.4.1 Understanding the SQLInput and SQLOutput Interfaces
13.3.4.2 Implementing readSQL() and writeSQL() Methods
13.3.5 Reading and Writing Data with a SQLData Implementation
13.3.5.1 Reading SQLData Objects from a Result Set
13.3.5.2 Retrieving SQLData Objects from a Callable Statement OUT Parameter
13.3.5.3 Passing SQLData Objects to a Callable Statement as an IN Parameter
13.3.5.4 Writing Data to an Oracle Object Using a SQLData Implementation
13.3.6 Understanding the ORAData Interface
13.3.6.1 Understanding ORAData Features
13.3.6.2 Retrieving and Inserting Object Data
13.3.7 Reading and Writing Data with a ORAData Implementation
13.3.7.1 Reading Data from an Oracle Object Using a ORAData Implementation
13.3.7.2 Writing Data to an Oracle Object Using a ORAData Implementation
13.3.8 Additional Uses for ORAData
13.3.9 The Deprecated CustomDatum Interface
13.4 Object-Type Inheritance
13.4.1 Creating Subtypes
13.4.2 Implementing Customized Classes for Subtypes
13.4.2.1 Use of ORAData for Type Inheritance Hierarchy
13.4.2.2 Use of SQLData for Type Inheritance Hierarchy
13.4.2.3 JPublisher Utility
13.4.3 Retrieving Subtype Objects
13.4.3.1 Using Default Mapping
13.4.3.2 Using SQLData Mapping
13.4.3.3 Using ORAData Mapping
13.4.4 Creating Subtype Objects
13.4.5 Sending Subtype Objects
13.4.6 Accessing Subtype Data Fields
13.4.6.1 Subtype Data Fields from the getAttribute() Method
13.4.6.2 Subtype Data Fields from the getOracleAttribute() Method
13.4.7 Inheritance Meta Data Methods
13.5 Using JPublisher to Create Custom Object Classes
13.5.1 JPublisher Functionality
13.5.2 JPublisher Type Mappings
13.5.2.1 Categories of SQL Types
13.5.2.2 Type-Mapping Modes
13.5.2.3 Mapping the Oracle object type to Java
13.5.2.4 Mapping Attribute Types to Java
13.5.2.5 Summary of SQL Type Categories and Mapping Settings
13.6 Describing an Object Type
13.6.1 Functionality for Getting Object Meta Data
13.6.2 Steps for Retrieving Object Meta Data
13.6.2.1 Example

14 Working with LOBs and BFILEs

14.1 Oracle Extensions for LOBs and BFILEs
14.2 Working with BLOBs and CLOBs
14.2.1 Getting and Passing BLOB and CLOB Locators
14.2.1.1 Retrieving BLOB and CLOB Locators
14.2.1.2 Passing BLOB and CLOB Locators
14.2.2 Reading and Writing BLOB and CLOB Data
14.2.2.1 Example: Reading BLOB Data
14.2.2.2 Example: Reading CLOB Data
14.2.2.3 Example: Writing BLOB Data
14.2.2.4 Example: Writing CLOB Data
14.2.3 Creating and Populating a BLOB or CLOB Column
14.2.3.1 Creating a BLOB or CLOB Column in a New Table
14.2.3.2 Populating a BLOB or CLOB Column in a New Table
14.2.4 Accessing and Manipulating BLOB and CLOB Data
14.2.5 Additional BLOB and CLOB Features
14.2.5.1 Additional BLOB Methods
14.2.5.2 Additional CLOB Methods
14.2.5.3 Creating Empty LOBs
14.3 Shortcuts For Inserting and Retrieving CLOB Data
14.4 Working With Temporary LOBs
14.4.1 Creating Temporary NCLOBs
14.5 Using Open and Close With LOBs
14.6 Working with BFILEs
14.6.1 Getting and Passing BFILE Locators
14.6.1.1 Retrieving BFILE Locators
14.6.1.2 Passing BFILE Locators
14.6.2 Reading BFILE Data
14.6.2.1 Example: Reading BFILE Data
14.6.3 Creating and Populating a BFILE Column
14.6.3.1 Creating a BFILE Column in a New Table
14.6.3.2 Populating a BFILE Column
14.6.4 Accessing and Manipulating BFILE Data
14.6.5 Additional BFILE Features

15 Using Oracle Object References

15.1 Oracle Extensions for Object References
15.2 Overview of Object Reference Functionality
15.2.1 Object Reference Getter and Setter Methods
15.2.1.1 Result Set and Callable Statement Getter Methods
15.2.1.2 Prepared and Callable Statement Setter Methods
15.2.2 Key REF Class Methods
15.3 Retrieving and Passing an Object Reference
15.3.1 Retrieving an Object Reference from a Result Set
15.3.2 Retrieving an Object Reference from a Callable Statement
15.3.3 Passing an Object Reference to a Prepared Statement
15.4 Accessing and Updating Object Values through an Object Reference
15.5 Custom Reference Classes with JPublisher

16 Working with Oracle Collections

16.1 Oracle Extensions for Collections (Arrays)
16.1.1 Choices in Materializing Collections
16.1.2 Creating Collections
16.1.3 Creating Multi-Level Collection Types
16.2 Overview of Collection (Array) Functionality
16.2.1 Array Getter and Setter Methods
16.2.1.1 Result Set and Callable Statement Getter Methods
16.2.1.2 Prepared and Callable Statement Setter Methods
16.2.2 ARRAY Descriptors and ARRAY Class Functionality
16.2.2.1 ARRAY Descriptors
16.2.2.2 ARRAY Class Methods
16.3 ARRAY Performance Extension Methods
16.3.1 Accessing oracle.sql.ARRAY Elements as Arrays of Java Primitive Types
16.3.2 ARRAY Automatic Element Buffering
16.3.3 ARRAY Automatic Indexing
16.4 Creating and Using Arrays
16.4.1 Creating ARRAY Objects and Descriptors
16.4.1.1 Steps in Creating ArrayDescriptor and ARRAY Objects
16.4.1.2 Creating Multi-Level Collections
16.4.1.3 Using ArrayDescriptor Methods
16.4.1.4 Serializable ARRAY Descriptors
16.4.2 Retrieving an Array and Its Elements
16.4.2.1 Retrieving the Array
16.4.2.2 Data Retrieval Methods
16.4.2.3 Comparing the Data Retrieval Methods
16.4.2.4 Retrieving Elements of a Structured Object Array According to a Type Map
16.4.2.5 Retrieving a Subset of Array Elements
16.4.2.6 Retrieving Array Elements into an oracle.sql.Datum Array
16.4.2.7 Accessing Multi-Level Collection Elements
16.4.3 Passing Arrays to Statement Objects
16.4.3.1 Passing an Array to a Prepared Statement
16.4.3.2 Passing an Array to a Callable Statement
16.5 Using a Type Map to Map Array Elements
16.6 Custom Collection Classes with JPublisher

17 Result Set Enhancements

17.1 Overview
17.1.1 Result Set Functionality and Result Set Categories Supported in JDBC 2.0
17.1.1.1 Scrollability, Positioning, and Sensitivity
17.1.1.2 Result Set Types for Scrollability and Sensitivity
17.1.1.3 Updatability
17.1.1.4 Concurrency Types for Updatability
17.1.1.5 Summary of Result Set Categories
17.1.2 Oracle JDBC Implementation Overview for Result Set Enhancements
17.1.2.1 Oracle JDBC Implementation for Result Set Scrollability
17.1.2.2 Oracle JDBC Implementation for Result Set Updatability
17.1.2.3 Implementing a Custom Client-Side Cache for Scrollability
17.2 Creating Scrollable or Updatable Result Sets
17.2.1 Specifying Result Set Scrollability and Updatability
17.2.2 Result Set Limitations and Downgrade Rules
17.2.2.1 Result Set Limitations
17.2.2.2 Result Set Downgrade Rules
17.2.2.3 Verifying Result Set Type and Concurrency Type
17.3 Positioning and Processing in Scrollable Result Sets
17.3.1 Positioning in a Scrollable Result Set
17.3.1.1 Methods for Moving to a New Position
17.3.1.2 Methods for Checking the Current Position
17.3.2 Processing a Scrollable Result Set
17.3.2.1 Backward versus Forward Processing
17.3.2.2 Presetting the Fetch Direction
17.4 Updating Result Sets
17.4.1 Performing a DELETE Operation in a Result Set
17.4.2 Performing an UPDATE Operation in a Result Set
17.4.2.1 Example
17.4.3 Performing an INSERT Operation in a Result Set
17.4.3.1 Example
17.4.4 Update Conflicts
17.5 Fetch Size
17.5.1 Setting the Fetch Size
17.5.2 Use of Standard Fetch Size versus Oracle Row-Prefetch Setting
17.6 Refetching Rows
17.7 Seeing Database Changes Made Internally and Externally
17.7.1 Seeing Internal Changes
17.7.2 Seeing External Changes
17.7.3 Visibility versus Detection of External Changes
17.7.4 Summary of Visibility of Internal and External Changes
17.7.5 Oracle Implementation of Scroll-Sensitive Result Sets
17.8 Summary of New Methods for Result Set Enhancements
17.8.1 Modified Connection Methods
17.8.2 New Result Set Methods
17.8.3 Statement Methods
17.8.4 Database Meta Data Methods

18 Row Set

18.1 Introduction
18.2 Row Set Setup and Configuration
18.3 Runtime Properties for Row Set
18.4 Row Set Listener
18.5 Traversing Through the Rows
18.6 Cached Row Set
18.6.1 CachedRowSet Constraints
18.7 JDBC Row Set

19 JDBC OCI Extensions

19.1 OCI Driver Connection Pooling
19.1.1 OCI Driver Connection Pooling: Background
19.1.2 OCI Driver Connection Pooling and Shared Servers Compared
19.1.3 Defining an OCI Connection Pool
19.1.3.1 Importing the oracle.jdbc.pool and oracle.jdbc.oci Packages
19.1.3.2 Creating an OCI Connection Pool
19.1.3.3 Setting the OCI Connection Pool Parameters
19.1.3.4 Checking the OCI Connection Pool Status
19.1.4 Connecting to an OCI Connection Pool
19.1.5 Statement Handling and Caching
19.1.6 JNDI and the OCI Connection Pool
19.2 OCI Driver Transparent Application Failover
19.2.1 Failover Type Events
19.2.2 TAF Callbacks
19.2.3 Java TAF Callback Interface
19.2.3.1 Handling the FO_ERROR Event
19.2.3.2 Handling the FO_ABORT Event
19.3 OCI HeteroRM XA
19.3.1 Configuration and Installation
19.3.2 Exception Handling
19.3.3 HeteroRM XA Code Example
19.4 Accessing PL/SQL Index-by Tables
19.4.1 Overview
19.4.2 Binding IN Parameters
19.4.3 Receiving OUT Parameters
19.4.3.1 Registering the OUT Parameters
19.4.3.2 Accessing the OUT Parameter Values

20 OCI Instant Client

20.1 Overview
20.2 Benefits of Instant Client
20.3 JDBC OCI Instant Client Installation Process
20.4 When to Use Instant Client
20.5 Patching Instant Client Shared Libraries
20.6 Regeneration of Data Shared Library
20.7 Database Connection Names for OCI Instant Client
20.8 Environment Variables for OCI Instant Client

21 End-To-End Metrics Support

21.1 Introduction
21.2 JDBC API For End-To-End Metrics

22 Performance Extensions

22.1 Update Batching
22.1.1 Overview of Update Batching Models
22.1.1.1 Oracle Model versus Standard Model
22.1.1.2 Types of Statements Supported
22.1.2 Oracle Update Batching
22.1.2.1 Oracle Update Batching Characteristics and Limitations
22.1.2.2 Setting the Connection Batch Value
22.1.2.3 Setting the Statement Batch Value
22.1.2.4 Checking the Batch Value
22.1.2.5 Overriding the Batch Value
22.1.2.6 Committing the Changes in Oracle Batching
22.1.2.7 Update Counts in Oracle Batching
22.1.3 Standard Update Batching
22.1.3.1 Limitations in the Oracle Implementation of Standard Batching
22.1.3.2 Adding Operations to the Batch
22.1.3.3 Executing the Batch
22.1.3.4 Committing the Changes in the Oracle Implementation of Standard Batching
22.1.3.5 Clearing the Batch
22.1.3.6 Update Counts in the Oracle Implementation of Standard Batching
22.1.3.7 Error Handling in the Oracle Implementation of Standard Batching
22.1.3.8 Intermixing Batched Statements and Non-Batched Statements
22.1.4 Premature Batch Flush
22.2 Additional Oracle Performance Extensions
22.2.1 Oracle Row Prefetching
22.2.1.1 Setting the Oracle Prefetch Value
22.2.1.2 Oracle Row-Prefetching Limitations
22.2.2 Defining Column Types
22.2.3 DatabaseMetaData TABLE_REMARKS Reporting
22.2.3.1 Considerations for getProcedures() and getProcedureColumns() Methods

23 JDBC Client-Side Security Features

23.1 JDBC Support for Oracle Advanced Security
23.1.1 OCI Driver Support for Oracle Advanced Security
23.1.2 Thin Driver Support for Oracle Advanced Security
23.2 JDBC Support for Login Authentication
23.3 JDBC Support for Data Encryption and Integrity
23.3.1 OCI Driver Support for Encryption and Integrity
23.3.2 Thin Driver Support for Encryption and Integrity
23.3.3 Setting Encryption and Integrity Parameters in Java
23.3.3.1 Complete example

24 JDBC in Applets

24.1 Connecting to the Database through the Applet
24.2 Connecting to a Database on a Different Host Than the Web Server
24.2.1 Using the Oracle Connection Manager
24.2.1.1 Installing and Running the Oracle Connection Manager
24.2.1.2 Writing the URL that Targets the Connection Manager
24.2.1.3 Connecting through Multiple Connection Managers
24.2.2 Using Signed Applets
24.3 Using Applets with Firewalls
24.3.1 Configuring a Firewall for Applets that use the JDBC Thin Driver
24.3.2 Writing a URL to Connect through a Firewall
24.4 Packaging Applets
24.5 Specifying an Applet in an HTML Page
24.5.1 CODE, HEIGHT, and WIDTH
24.5.2 CODEBASE
24.5.3 ARCHIVE

25 Reference Information

25.1 Valid SQL-JDBC Datatype Mappings
25.2 Supported SQL and PL/SQL Datatypes
25.3 Embedded SQL92 Syntax
25.3.1 Disabling Escape Processing
25.3.2 Time and Date Literals
25.3.2.1 Date Literals
25.3.2.2 Time Literals
25.3.2.3 Timestamp Literals
25.3.3 Scalar Functions
25.3.4 LIKE Escape Characters
25.3.5 Outer Joins
25.3.6 Function Call Syntax
25.3.7 SQL92 to SQL Syntax Example
25.4 Oracle JDBC Notes and Limitations
25.4.1 CursorName
25.4.2 SQL92 Outer Join Escapes
25.4.3 PL/SQL TABLE, BOOLEAN, and RECORD Types
25.4.4 IEEE 754 Floating Point Compliance
25.4.5 Catalog Arguments to DatabaseMetaData Calls
25.4.6 SQLWarning Class
25.4.7 Binding Named Parameters
25.4.7.1 Retaining Bound Values

26 Server-Side Internal Driver

26.1 Introduction
26.2 Connecting to the Database with the Server-Side Internal Driver
26.2.1 Connecting with the OracleDriver Class defaultConnection() Method
26.2.2 Connecting with the OracleDataSource.getConnection() Method
26.3 Exception-Handling Extensions for the Server-Side Internal Driver
26.3.1 Example
26.4 Session and Transaction Context for the Server-Side Internal Driver
26.5 Testing JDBC on the Server
26.6 Loading an Application into the Server
26.6.1 Loading Class Files into the Server
26.6.2 Loading Source Files into the Server
26.7 Server-Side Character Set Conversion of oracle.sql.CHAR Data

27 Proxy Authentication

27.1 Middle-Tier Authentication Through Proxy Connections

28 Coding Tips and Troubleshooting

28.1 JDBC and Multithreading
28.2 Performance Optimization
28.2.1 Disabling Auto-Commit Mode
28.2.1.1 Example: Disabling AutoCommit
28.2.2 Standard Fetch Size and Oracle Row Prefetching
28.2.3 Standard and Oracle Update Batching
28.2.4 Mapping Between Built-in SQL and Java Types
28.3 Common Problems
28.3.1 Memory Consumption for CHAR Columns Defined as OUT or IN/OUT Variables
28.3.2 Memory Leaks and Running Out of Cursors
28.3.3 Boolean Parameters in PL/SQL Stored Procedures
28.3.4 Opening More Than 16 OCI Connections for a Process
28.3.5 Using statement.cancel()
28.4 Basic Debugging Procedures
28.4.1 Oracle Net Tracing to Trap Network Events
28.4.1.1 Client-Side Tracing
28.4.1.2 Server-Side Tracing
28.4.2 Third Party Debugging Tools
28.5 Transaction Isolation Levels and Access Modes

A JDBC Error Messages

A.1 General Structure of JDBC Error Messages
A.2 General JDBC Messages
A.2.1 JDBC Messages Sorted by ORA Number
A.2.2 JDBC Messages Sorted Alphabetically
A.3 HeteroRM XA Messages
A.3.1 HeteroRM XA Messages Sorted by ORA Number
A.3.2 HeteroRM XA Messages Sorted Alphabetically
A.4 TTC Messages
A.4.1 TTC Messages Sorted by ORA Number
A.4.2 TTC Messages Sorted Alphabetically

Index