Documentation Contents
[Top] [Prev] [Next] [Bottom]

Getting Started with the JDBC API

1 Introduction

1.1 What the JDBC 3.0 API Includes . . . . . . . . . . . . .
1.2 What Is the JDBC API?
1.2.1 What Does the JDBC API Do?
1.2.2 A Base for Other APIs
1.2.3 The JDBC API Versus ODBC and UDA
1.2.4 Two-tier and Three-tier Models
1.2.5 SQL Conformance
1.2.6 JDBC Products
1.2.7 Java Software Framework
1.2.8 JDBC Driver Types
1.2.9 Obtaining JDBC Drivers
1.2.10 Java-relational DBMSs
1.2.11 Other Products

2 Connection

2.1 Connection Overview . . . . . . . . . . . . .
2.1.1 Opening a Connection
2.1.2 URLs in General Use
2.1.3 JDBC URLs
2.1.4 The odbc Subprotocol
2.1.5 Registering Subprotocols
2.1.6 Sending SQL Statements
2.1.7 Transactions
2.1.8 Transaction Isolation Levels
2.1.9 Savepoints
2.1.10 Freeing DBMS Resources
2.1.11 Using Type Maps

3 DriverManager

3.1 DriverManager Overview . . . . . . . . . . . . .
3.1.1 Keeping Track of Available Drivers
3.1.2 Establishing a Connection
3.1.3 DriverManager Methods Are Static

4 DataSource

4.1 DataSource Overview . . . . . . . . . . . . .
4.1.1 Properties
4.1.2 Using JNDI
4.1.3 Creating and Registering a DataSource Object
4.1.4 Connecting to a Data Source
4.1.5 DataSource Implementations
4.1.6 Logging and Tracing
4.1.7 Advantages of Using JNDI

5 Statement

5.1 Statement Overview . . . . . . . . . . . . .
5.1.1 Creating Statement Objects
5.1.2 Executing Statements Using Statement Objects
5.1.3 Statement Completion
5.1.4 Retrieving Automatically Generated Keys
5.1.5 Closing Statements
5.1.6 SQL Escape Syntax in Statements
5.1.7 Sending Batch Updates
5.1.8 Giving Performance Hints
5.1.9 Executing Special Kinds of Statements

6 ResultSet

6.1 ResultSet Overview . . . . . . . . . . . . .
6.1.1 Rows and Columns
6.1.2 Cursors
6.1.3 Cursor Movement Examples
6.1.4 Determining the Number of Rows in a Result Set
6.1.5 Retrieving Column Values
6.1.6 Which getter Method to Use
6.1.7 Types of Result Sets
6.1.8 Concurrency Types
6.1.9 Holdability
6.1.10 Providing Performance Hints
6.1.11 Creating Different Types of Result Sets
6.1.12 Using a Prepared Statement to Create Result Sets
6.1.13 Requesting Features That Are Not Supported
6.1.14 Using updater Methods
6.1.15 Deleting a Row
6.1.16 Inserting Rows
6.1.17 Positioned Updates
6.1.18 Queries That Produce Updatable Result Sets
6.1.19 Using Streams for Very Large Row Values
6.1.20 NULL Result Values
6.1.21 Closing a ResultSet Object
6.1.22 JDBC Compliance

7 PreparedStatement

7.1 PreparedStatement Overview . . . . . . . . . . . . .
7.1.1 Creating PreparedStatement Objects
7.1.2 Passing IN Parameters
7.1.3 Parameter Metadata
7.1.4 Data Type Conformance on IN Parameters
7.1.5 Using setObject
7.1.6 Sending JDBC NULL as an IN parameter
7.1.7 Sending Very Large IN Parameters
7.1.8 Using PreparedStatement Objects in Batch Updates

8 CallableStatement

8.1 CallableStatement Overview . . . . . . . . . . . . .
8.1.1 Creating a CallableStatement Object
8.1.2 IN Parameters
8.1.3 Making Batch Updates
8.1.4 OUT Parameters
8.1.5 Numbering of Parameters
8.1.6 INOUT Parameters
8.1.7 Retrieve OUT Parameters after Results
8.1.8 Retrieving NULL Values as OUT Parameters

9 Mapping SQL and Java Types

9.1 Mapping Overview . . . . . . . . . . . . .
9.2 Mapping SQL Types to Java Types
9.3 Basic JDBC Types
9.3.1 CHAR, VARCHAR, and LONGVARCHAR
9.3.2 BINARY, VARBINARY, and LONGVARBINARY
9.3.3 BIT
9.3.4 BOOLEAN
9.3.5 TINYINT
9.3.6 SMALLINT
9.3.7 INTEGER
9.3.8 BIGINT
9.3.9 REAL
9.3.10 DOUBLE
9.3.11 FLOAT
9.3.12 DECIMAL and NUMERIC
9.3.13 DATE, TIME, and TIMESTAMP
9.4 Advanced JDBC Data Types
9.4.1 DATALINK
9.4.2 BLOB
9.4.3 CLOB
9.4.4 ARRAY
9.4.5 DISTINCT
9.4.6 STRUCT
9.4.7 REF
9.4.8 JAVA_OBJECT
9.5 Examples of Mapping
9.5.1 Simple SQL Statement
9.5.2 SQL Statement with IN Parameters
9.5.3 SQL Statement with INOUT Parameters
9.6 Custom Mapping
9.7 Dynamic Data Access
9.8 Storing Java Objects in a Database
9.9 Tables for Type Mapping
9.9.1 JDBC Types Mapped to Java Types
9.9.2 Java Types Mapped to JDBC Types
9.9.3 JDBC Types Mapped to Java Object Types
9.9.4 Java Object Types Mapped to JDBC Types
9.9.5 Conversions by setObject
9.9.6 Conversions by ResultSet.getter Methods
9.9.7 JDBC Types Mapped to Database-specific SQL Types

10 Rowset

10.1 Rowset Overview
10.1.1 The Event Model for Rowsets
10.1.2 Properties for a Rowset
10.1.3 Setting Parameters for the Command String
10.1.4 Traversing a RowSet Object
10.1.5 Executing a Command
10.1.6 Using a RowSet Object's Metadata
10.2 Standard Implementations
10.2.1 Implementation Basics
10.2.2 Overview of the JdbcRowSet Implementation
10.2.3 Overview of the CachedRowSet Implementation
10.2.4 Uses for a CachedRowSet Object
10.2.5 Creating a CachedRowSet Object
10.2.6 Setting a SyncProvider Object
10.2.7 Populating a CachedRowSet Object
10.2.8 Accessing Data
10.2.9 Modifying Data
10.2.10 Customizing Readers and Writers
10.2.11 Other Methods
10.2.12 Using the javax.sql.rowset.spi Package
10.2.13 CachedRowSet Summary
10.2.14 WebRowSet Implementation
10.2.15 FilteredRowSet Implementation
10.2.16 JoinRowSet Implementation

JDBC-ODBC Bridge Enhancements

Appendix A: Summary of New Features

A.1 Overview of JDBC 3.0 API Changes
A.1.1 Features Introduced in the JDBC 3.0 API
A.1.2 Features Introduced in the JDBC 2.0 Optional Package
A.2 Overview of JDBC 2.0 Core API Changes
A.3 Summary of New Functionality
A.3.1 Scrollable Result Sets
A.3.2 Batch Updates
A.3.3 Programmatic Updates
A.3.4 Other New Features
A.4 Support for Advanced Data Types
A.4.1 What Are the SQL99 Data Types?
A.4.2 Summary of Support for the SQL99 Data Types
A.4.3 Mapping of the SQL99 Types
A.4.4 SQL Locators
A.4.5 Support for Storing Java Objects

Appendix B: Sample Code


[Top] [Prev] [Next] [Bottom]

Copyright © 1993, 2010, Oracle and/or its affiliates. All rights reserved.

Please send comments using this Feedback page.
Oracle Corporation and/or its affiliates
Java Technology