JDBC API Tutorial and Reference, 3/e (Paperback)
Maydene Fisher, Jon Ellis, Jonathan Bruce
- 出版商: Addison Wesley
- 出版日期: 2003-06-21
- 售價: $2,900
- 貴賓價: 9.5 折 $2,755
- 語言: 英文
- 頁數: 1280
- 裝訂: Paperback
- ISBN: 0321173848
- ISBN-13: 9780321173843
已絕版
買這商品的人也買了...
-
$580$458 -
$680$537 -
$980$774 -
$880$695 -
$1,600$1,568 -
$450$351 -
$750$638 -
$760$600 -
$650$553 -
$580$458 -
$590$466 -
$680$537 -
$690$538 -
$420$332 -
$720$562 -
$650$553 -
$780$616 -
$720$569 -
$560$442 -
$620$490 -
$750$675 -
$560$504 -
$480$408 -
$750$593 -
$720$569
相關主題
商品描述
This book provides the definitive tutorial and reference to the JDBC™ API, the technology that enables universal data access for the Java™ programming language. This new edition has been updated and expanded to cover the entire JDBC 3.0 API, including the java.sql package and the javax.sql package, the package that facilitates building server-side applications.
Containing in-depth explanations that go beyond the specification, this complete resource pairs a step-by-step tutorial with a comprehensive reference to every class and interface.
For those new to Java technology, the book includes an introduction to the Java programming language and to SQL. It builds on this basic knowledge to walk you through the creation of a JDBC application--from setting up a database and establishing a connection to retrieving values from result sets and using prepared statements. In addition, the authors provide many examples along the way that demonstrate how to execute common tasks. The book then turns to more advanced topics, focusing on features such as scrollable and updatable result sets, batch updates, SQL99 data types, custom mapping, savepoints, statement pooling, automatically generated keys, and more.
In addition to in-depth coverage of the JDBC metadata API, the book gives you the latest information on rowsets, the technology that makes it possible to handle data sets as JavaBeans™ components. As an added bonus, you get a preview of the standard implementations for JdbcRowSet, CachedRowSet, WebRowSet, JoinRowSet, and FilteredRowSet objects.
From Array to XADataSource, an easy-to-use alphabetical reference provides concise but complete information on each class and interface in the JDBC API. Each entry includes an overview with usage examples as well as a comprehensive explanation of the methods and fields.
A chapter on mapping SQL types and types in the Java programming language, an appendix for driver writers, a summary of the new features in the JDBC 2.0 and 3.0 APIs, and a glossary complete this indispensable resource for all database programmers.
The Java™ Series is supported, endorsed, and authored by the creators of the Java technology at Sun Microsystems, Inc. It is the official place to go for complete, expert, and definitive information on Java technology. The books in this Series provide the inside information you need to build effective, robust, and portable applications and applets. The Series is an indispensable resource for anyone targeting the Java™ 2 platform.
Table of Contents
Acknowledgments.
PART ONE.
1. Introduction.
Conventions Used in This Book.
Icons to Indicate New Material.
Special Page Designations in the Index.
SQLException Is Implied in Method Explanations.
Some Method Explanations Are Combined.
Contents of the Book.
Part Two.
Suggested Order for Reading Chapters.
Where to Find Information by Topic.
Resources on the Web.
What Is the JDBC API?
A Base for Other APIs.
The JDBC API versus ODBC.
Two-tier and Three-tier Models.
SQL Conformance.
Products Based on JDBC Technology.
JDBC Product Framework.
JDBC Driver Types.
Obtaining JDBC Drivers.
Java-relational DBMSs.
Other Products.
The JDBC API and the Java Platforms.
The JDBC API and the J2EE Platform.
The JDBC API and the J2ME Platform.
Java Overview.
Java Is Object-oriented.
Java Makes It Easy to Write Correct Code.
Java Includes a Library of Classes and Interfaces.
Java Is Extensible.
Java Is Secure.
Java Performs Well.
Java Scales Well.
Java Is Multithreaded.
Relational Database Overview.
SELECT Statements.
WHERE Clauses.
Joins.
Common SQL Commands.
Result Sets and Cursors.
Transactions.
Stored Procedures.
Metadata.
2. Basic Tutorial.
Setting Up a Database.
Establishing a Connection.
Making the Connection.
Setting Up Tables.
Creating JDBC Statements.
Executing Statements.
Entering Data into a Table.
Getting Data from a Table.
Retrieving Values from Result Sets.
Retrieving Column Values.
Using the Method getString.
Updating Tables.
Milestone: The Basics of JDBC.
Using Prepared Statements.
Creating a PreparedStatement Object.
Supplying Values for PreparedStatement Parameters.
Using a Loop to Set Values.
Return Values for the Method executeUpdate.
Using Joins.
Using Transactions.
Committing a Transaction.
Using Transactions to Preserve Data Integrity.
When to Roll Back a Transaction.
Stored Procedures.
Calling a Stored Procedure Using the JDBC API.
Creating Complete JDBC Applications.
Importing Classes to Make Them Visible.
Using the main Method.
Using try and catch Blocks.
Retrieving Exceptions.
Retrieving Warnings.
Running the Sample Applications.
Sample Code.
Sample Code 3 and 4.
Sample Code 5.
Sample Code 6.
Creating an Applet from an Application.
Running an Applet.
Sample Code 7 and 8.
Stored Procedures Using SQLJ and the JDBC API.
Installing a Stored Procedure.
Declaring a Stored Procedure in SQL.
3. Advanced Tutorial.
Using Code Examples.
Moving the Cursor in Scrollable Result Sets.
Moving the Cursor Forward and Backward.
Moving the Cursor to a Designated Row.
Getting the Cursor Position.
Making Updates to Updatable Result Sets.
Updating a Result Set Programmatically.
Inserting and Deleting Rows Programmatically.
Sample Code 20.
Deleting a Row Programmatically.
Seeing Changes in Result Sets.
Getting the Most Recent Data.
Making Batch Updates.
Batch Update Exceptions.
Sample Code 21.
SQL99 Data Types.
Using SQL99 Data Types.
Blob, Clob, and Array Objects.
Creating an SQL Structured Type.
Creating a DISTINCT Type.
Sample Code 22.
Using References to Structured Types.
Sample Code 23.
Using SQL99 Types as Column Values.
Sample Code 24.
Inserting SQL99 Types into a Table.
Sample Code 25.
Using Custom Mapping.
Using a Connection's Type Map.
Using Your Own Type Map.
Using a DataSource Object.
Deploying a Basic DataSource Object.
Deploying Other DataSource Implementations.
Getting and Using a Pooled Connection.
Sample Code 26.
Deployment for Distributed Transactions.
Using Connections for Distributed Transactions.
Sample Code 27.
JDBC 3.0 Functionality.
Sample Code 28.
Using Automatically Generated Keys.
Sample Code 29.
4. MetaData Tutorial.
Sample Code 9.
Using Other ResultSetMetaData Methods.
Getting Column Type Information.
Sample Code 10 and 11.
Sample Code 12.
Getting Other Information.
Using ResultSetMetaData Features.
Getting Other Information.
Using a DatabaseMetaData Object.
Methods That Return a String.
Methods That Return an int.
Methods That Return a boolean.
Methods That Return a ResultSet Object.
Sample Code 13.
Getting Information about DBMS Data Types.
Sample Code 14.
Getting Information about Primary and Foreign Keys.
Sample Code 15.
Sample Code 16.
Methods Added in the JDBC 2.0 Core API.
Getting Other Information.
Methods Added in the JDBC 3.0 API.
Getting Information about ResultSet Objects.
Using a ParameterMetaData Object.
Generic Applications.
Sample Code 19.
5. Rowset Tutorial.
Using a Rowset.
Rowsets and Event Notification.
Obtaining a Scrollable and Updatable Rowset.
Using a Rowset for Scrolling and Updating.
Updating a Rowset.
An EJB Example.
Differences in Rowsets.
EJB and Distributed Transactions.
A Stateless SessionBean Object.
Overview of an EJB Application.
The Remote Interface.
The Home Interface.
The Client Class.
The Enterprise Bean.
PART TWO.
6. Array.
Getting Base Type Information.
Materializing Array Data.
Four Versions of the Method getArray.
Four Versions of the Method getResultSet.
Using Array Methods.
Storing Array Objects.
Array Interface Definition.
Array Methods.
7. BatchUpdateException.
Retrieving BatchUpdateException Information.
BatchUpdateException Class Definition.
BatchUpdateException Constructors.
BatchUpdateException Methods.
Methods Defined in BatchUpdateException.
8. Blob.
Materializing Blob Data.
Storing a Blob Object.
Finding Patterns within a Blob Object.
Methods for Modifying a Blob Object.
Locators and Updates.
Blob Interface Definition.
Blob Methods.
9. CallableStatement.
Named Parameters.
IN Parameters.
Making Batch Updates.
OUT Parameters.
Numbering of Parameters.
INOUT Parameters.
Retrieving OUT Parameters after Results.
Retrieving NULL Values as OUT Parameters.
Getting Information about Parameters.
CallableStatement Definition.
CallableStatement Methods.
Methods Defined in CallableStatement.
10. Clob.
Materializing Clob Data.
Storing a Clob Object.
Updating a Clob Object.
Locators and Updates.
Clob Interface Definition.
Clob Methods.
11. Connection.
URLs in General Use.
JDBC URLs.
The odbc Subprotocol.
Registering Subprotocols.
Sending SQL Statements.
Transactions.
Transaction Isolation Levels.
Using Savepoints.
Freeing DBMS Resources.
Using Type Maps.
Connection Interface Definition.
Connection Methods.
Connection Fields.
12. ConnectionEvent.
ConnectionEvent Interface Definition.
ConnectionEvent Constructors.
ConnectionEvent Methods.
Methods Defined in javaxsqlConnectionEvent.
13. ConnectionEventListener.
Registering a ConnectionEventListener Object.
ConnectionEventListener Interface Definition.
ConnectionEventListener Methods.
14. ConnectionPoolDataSource.
Reusing Statements.
Properties for Connection and Statement Pooling.
Closing a Pooled Statement.
ConnectionPoolDataSource Interface Definition.
ConnectionPoolDataSource Methods.
15. DatabaseMetaData.
ResultSet Objects as Return Values.
String Patterns as Arguments.
Pseudo Columns.
Features Added in the JDBC 2.0 Core API.
Getting Advanced Type Information.
Methods and Fields Added in the JDBC 3.0 API.
Methods Modified in the JDBC 3.0 API.
DatabaseMetaData Interface Definition.
DatabaseMetaData Methods.
DatabaseMetaData Fields.
16. DataSource.
Using JNDI.
Creating and Registering a DataSource Object.
Connecting to a Data Source.
DataSource Implementations.
Logging and Tracing.
Advantages of Using JNDI.
DataSource Interface Definition.
DataSource Methods.
17. DataTruncation.
Data Truncation on Reads.
Data Truncation on Writes.
What a DataTruncation Object Contains.
Retrieving DataTruncation Information.
DataTruncation Class Definition.
DataTruncation Constructor.
DataTruncation Methods.
Methods Defined in DataTruncation.
18. Date.
Deprecated Methods.
Retrieving a Date Object.
Advanced Features.
Date Class Definition.
Date Constructors.
Date Methods.
19. Distinct Types.
Storing Distinct Objects.
Using Distinct Data Types.
Custom Mapping of Distinct Types.
20. Driver.
JDBC Implementation Alternatives.
Driver Interface Definition.
Driver Methods.
21. DriverManager.
Establishing a Connection.
DriverManager Methods Are Static.
DriverManager Class Definition.
DriverManager Methods.
22. DriverPropertyInfo.
Getting and Setting Fields.
DriverPropertyInfo Class Definition.
DriverPropertyInfo Constructor.
DriverPropertyInfo Fields.
23. ParameterMetaData.
Getting Information from a ParameterMetaData Object.
Using Parameter Metadata Wisely.
ParameterMetaData Interface Definition.
ParameterMetaData Methods.
ParameterMetaData Fields.
24. PooledConnection.
How Connection Pooling Works.
The Life Cycle of a PooledConnection Object.
PooledConnection Interface Definition.
PooledConnection Methods.
25. PreparedStatement.
Passing IN Parameters.
Parameter Metadata.
Data Type Conformance on IN Parameters.
Using setObject.
Sending JDBC NULL as an IN Parameter.
Sending Very Large IN Parameters.
Using PreparedStatement Objects in Batch Updates.
Pooling Prepared Statements.
PreparedStatement Interface Definition.
PreparedStatement Methods.
26. Ref.
Creating a Ref Object.
Storing a Ref Object.
Dereferencing a Ref Object.
Sample Code 30.
Modifying a Ref Object.
Ref Interface Definition.
Ref Methods.
27. ResultSet.
Cursors.
Cursor Movement Examples.
Determining the Number of Rows in a Result Set.
Retrieving Column Values.
Which Method to Use for Retrieving Values.
Using the Method getObject.
Types of Result Sets.
Concurrency Types.
Result Set Holdability.
Providing Performance Hints.
Creating Different Types of Result Sets.
Using a Prepared Statement to Create Result Sets.
Requesting Features That Are Not Supported.
Updating Column Values.
Deleting a Row.
Inserting Rows.
Positioned Updates.
Queries That Produce Updatable Result Sets.
What Is Visible to Transactions.
Visibility of Changes Made by Others.
Visibility of a Result Set's Own Changes.
Detecting Changes.
Refetching a Row.
Using Streams for Very Large Row Values.
NULL Result Values.
Optional or Multiple Result Sets.
Closing a ResultSet Object.
JDBC Compliance.
ResultSet Interface Definition.
ResultSet Methods.
ResultSet Fields.
28. ResultSetMetaData.
Using ResultSetMetaData.
ResultSetMetaData Interface Definition.
ResultSetMetaData Methods.
ResultSetMetaData Fields.
29. RowSet.
Properties for a Rowset.
Setting Parameters for the Command String.
Traversing a RowSet Object.
Executing a Command.
Using a RowSet Object's Metadata.
Standard Implementations.
Overview of the CachedRowSet Implementation.
Uses for a CachedRowSet Object.
Creating a CachedRowSetImpl Object.
Populating a CachedRowSet Object.
Accessing Data.
Modifying Data.
Customizing Readers and Writers.
Other Methods.
WebRowSet Implementation.
FilteredRowSet Implementation.
JoinRowSet Implementation.
RowSet Interface Definition.
RowSet Methods.
RowSet Fields.
30. RowSetEvent.
Creating a RowSetEvent Object.
RowSetEvent Interface Definition.
RowSetEvent Constructor.
RowSetEvent Methods.
31. RowSetInternal.
RowSetInternal Methods.
32. RowSetListener.
Using RowSetListener Methods.
RowSetListener Interface Definition.
RowSetListener Methods.
33. RowSetMetaData.
RowSetMetaData Interface Definition.
RowSetMetaData Methods.
RowSetMetaData Fields.
34. RowSetReader.
Reading Data for a Disconnected Rowset.
RowSetReader Interface Definition.
RowSetReader Methods.
35. RowSetWriter.
RowSetWriter Interface Definition.
RowSetWriter Methods.
36. Savepoint.
Using a Savepoint Object.
Removing Savepoint Objects.
Retrieving a Savepoint Object Identifier.
Savepoint Interface Definition.
Savepoint Methods.
37. SQLData.
Retrieving a Custom-mapped Object.
Storing an Object with a Custom Mapping.
SQLData Interface Definition.
SQLData Methods.
38. SQLException.
Retrieving SQLException Information.
What an SQLException Means.
SQLException Class Definition.
SQLException Constructors.
SQLException Methods.
39. SQLInput.
Using reader Methods.
SQLInput Interface Definition.
SQLInput Methods.
40. SQLOutput.
SQLOutput Interface Definition.
SQLOutput Methods.
41. SQLPermission.
SQLPermission Class Definition.
SQLPermission Constructors.
42. SQLWarning.
Retrieving SQLWarning Information.
SQLWarning Class Definition.
SQLWarning Constructors.
SQLWarning Methods.
43. Statement.
Executing Statements Using Statement Objects.
Statement Completion.
Retrieving Automatically Generated Keys.
Closing Statements.
SQL Escape Syntax in Statements.
Sending Batch Updates.
Giving Performance Hints.
Executing Special Kinds of Statements.
Statement Interface Definition.
Statement Methods.
Statement Fields.
44. Struct.
Creating an SQL Structured Type.
Storing Instances of a Structured Type.
Creating a Struct Object.
Mapping SQL Inheritance.
Ordering of Attributes.
Storing a Struct Object.
Struct Interface Definition.
Struct Methods.
45. Time.
Deprecated Methods.
Retrieving a Time Object.
Advanced Features.
Time Class Definition.
Time Constructors.
Time Methods.
46. Timestamp.
Retrieving a Timestamp Object.
Advanced Features.
Timestamp Class Definition.
Timestamp Constructors.
Timestamp Methods.
47. Types.
Using the Constant OTHER.
JDBC Types Added in the JDBC 2.0 Core API.
JDBC Data Types Added in the JDBC 3.0 API.
Types Class Definition.
48. XAConnection.
Distributed Transaction Requirements.
Creating an XAConnection Object.
What an XAResource Object Does.
How the Two-phase Commit Protocol Works.
Using an XAResource Object to Commit.
The XAResource Interface.
Steps in a Distributed Transaction.
Distributed Transactions and EJB.
XAConnection Interface Definition.
XAConnection Methods.
49. XADataSource.
XADataSource Objects and Resource Managers.
XADataSource Interface Definition.
XADataSource Methods.
50. Mapping SQL and Java Types.
Mapping SQL Types to Java Types.
Basic JDBC Types.
BINARY, VARBINARY, and LONGVARBINARY.
BIT.
TINYINT.
SMALLINT.
INTEGER.
BIGINT.
REAL.
DOUBLE.
FLOAT.
DECIMAL and NUMERIC.
DATE, TIME, and TIMESTAMP.
Advanced JDBC Data Types.
CLOB.
ARRAY.
DISTINCT.
STRUCT.
REF.
JAVA_OBJECT.
JDBC Types Added in the JDBC 3.0 API.
DATALINK.
Examples of Mapping.
1079.
SQL Statement with INOUT Parameters.
Custom Mapping.
Dynamic Data Access.
Storing Java Objects in a Database.
Tables for Type Mapping.
Java Types Mapped to JDBC Types.
JDBC Types Mapped to Java Object Types.
Java Object Types Mapped to JDBC Type.
Conversions by setObject.
Conversions by ResultSet getter Methods.
JDBC Types Mapped to Database-specific SQL Types.
Appendix A. For Driver Writers.
Implement Methods in the Interfaces.
Requirements for JDBC 1.0 API Compliance.
Requirements for JDBC 2.0 API Compliance.
Requirements for JDBC 3.0 API Compliance.
API That Is Already Implemented.
Additional Requirements.
Support Extensions to SQL92 Entry Level.
Support Scalar Functions.
Provide Locks for Positioned Updates and Deletes.
Support Multithreading.
Throw Exceptions for Truncated Input Parameters.
Use Default Behaviors for SQL99 Data Types.
Permitted Variants.
Variation in Fundamental Properties.
Adding Functionality.
Security Responsibilities of Drivers.
Check All Local File Access.
Assume the Worst.
Use SQLException for Exceptions.
Implementation Suggestions.
Provide "Finalize" Methods.
Avoid Implementation-dependent States.
Connection and Statement Pooling Implementations.
JDBC Test Suite.
Connectors.
Appendix B. Summary of Changes.
Summary of New Functionality.
Connection Pooling and Reusing Prepared Statements.
Retrieval of Parameter Metadata.
Automatically Generated Keys.
Ability to Have Multiple Open ResultSet Objects.
Holdable Cursor Support.
New Updating Capabilities.
New Data Types.
Complete List of JDBC 3.0 API Changes.
New Methods and Fields.
Overview of JDBC 2.0 Core API Changes.
Summary of New Functionality.
Batch Updates.
Programmatic Updates.
Other New Features.
Support for Advanced Data Types.
What Are the SQL99 Data Types?
Summary of Support for the SQL99 Data Types.
Mapping of the New SQL99 Types.
SQL Locators.
Support for Storing Java Objects.
JDBC 2.0 Core API Changes.
Additions to Existing Interfaces and Classes.
Deprecated Methods and Constructors.
New Interfaces, Classes, and Exceptions.
JDBC Optional Package Features.
Connection Pooling.
Support for Distributed Transactions.
Rowsets.
Complete List of Optional Package API.
Post JDBC 1.0 API Changes.
AutoClose Mode Dropped.
Early Design Decisions.
PreparedStatement Methods for Setting Column Values.
CallableStatementregisterOutParameter Method.
Support for Large OUT Parameters.
isNull versus wasNull.
Java Type Names or JDBC Type Names.
Where to Send Suggestions.
Glossary.