Book Illustration
Go Back
About the Book Readme
What's on the CD JDBC Links
JDBC
DEVELOPER'S
RESOURCE

Table of Contents
   
Introduction xiii
 
  About This Book xiv  
  Target Audience xv  
  Resource xv  
  Conventions Used in This Book xvi
  About the CD xvii  
  About the Web Site xviii
 
Part One: Java Tutorial 2
 
Chapter 1 A Java Language Primer 5
 
  History of Java 6  
  Features 6
  Design 7
  C++ and Java 8
  Emerging Java Technologies 8
  Java Beans 6
  Java JDK Version 1.1 9
  Java Database Access Standard (JDBC) 12
  Flavors of JDBC 13
  Basic Elements of Java 15
  Numeric Data Types 15
  Arrays 18
  Strings 18
  Labels 19
  Memory Management in Java 19
  Exception Handling 20
  C and C++ Features Not Present in Java 21
  typedefs, defines, and Pre-processor Support 21
  Structures and Unions 22
  Functions 23
  Operator Overloading 23
  Automatic Coercion 23
  Pointers 23
 
Chapter 2 Relational Database Primer 27
 
  History of the Relational Database 28
  Relational Database Concepts 28
  Relational Database Terminology 32
  Structured Query Language 35
  Basic SQL Statements 36
  SQL Standards 38
  Call Level Interface 39
  Transactions, Database Logging
  and Isolation Levels, and Concurrency 39
  SQL Query Optimization 46
  Dynamic SQL Execution 48
 
Chapter 3 JDBC Application Programmer Interface (API) 51
 
  SQL Statement Execution with JDBC 52
  DriverManager Class 55
  The java.sql.Connection Class 57
  The java.sql.Statement Class 58
  The java.sql.ResultSet class 62
  The java.sql.PreparedStatement Class 65
  The java.sql.PreparedStatement Class 69
  JDBC Security 69
  JDBC Usage 70
  Applet 70
  Java for General-Purpose Applications 72
  CGI Application 72
  JDBC Application Design 72
  JDBC Data Type Mapping 76
  Multi-Threading in Java 79
  Transactions 80
  Cursors 80
  SQL Level 80
 
Chapter 4 JDBC Tutorial 85
 
  A Simple JDBC Application 87
  Use of the Prepared Statement 88
  Positioned Cursor Update 88
  Transaction Modes 88
  Java Applet 89
  Three-Tiered Remote Method
  Invocation (RMI) Application 90
  CGI Application 91
  Metadata Usage 91
  ResultSet Array Example 92
  Basic JDBC Programming 92
  Basic JDBC Steps 94
  Load Driver 94
  Create Connection 95
  Create Statement 95
  Execute SQL Statement and Return ResultSet 96
  Iterate ResultSet 96
  A Dynamic SQL Select Program 98
  Load Driver and Get Database Connection 100
  Retrieve Table Name from Command Line 100
  Argument 101
  Build Select Statement 101
  Create Statement Object and Execute SQL Statement 102
  Create a ResultSetMetaData Object 102
  Traverse the ResultSet 102
  Prepared Statement 106
  Create Query String with Parameters and
  Create PreparedStatement Object 106
  Set Parameter Value and Execute Query 108
  Loop for 2000 Iterations 109
  Positioned Cursor Update 116
  Load Database Driver and Create Connection 116
  Create DatabaseMetaData Object and Test
  for Positioned Update Functionality 117
  Execute Select Query 118
  Get Cursor Name and Execute Update Statement 118
  Review Results 119
  Transaction Modes 123
  Load Driver and Create Connection 123
  Set the Auto-Commit Mode 124
  Create Statement and
  Execute DDL and DML 124
  Commit Work 125
  Create Prepared Statement
  and Execute Updates 125
  Rollback Work and Display Results 126
  catch code block 127
  CGI Application 130
  Load Driver Manager and Create Connection 131
  Create Prepared Statement with Parameter 131
  Parse CGI Arguments 132
  Set Parameters and Execute Query 133
  Retrieve Results
  and Display Formatted Output 133
  Metadata Access 140
  Retrieve Query from the Command Line 140
  Load Driver and Create Connection 141
  Create Statement and Execute the Query 142
  Retrieve the ResultSet and
  Determine the Number of Columns 142
  Execute Formatting Routine 142
  Iterate Results Displaying Formatted Data 148
  Scrolling ResultSet Array 160
  Declare RSArray Object 161
  Load DriverManager and Connection 161
  Create Statement and Execute 162
  Iterate ResultSet Adding
  to ResultSetArray Buffer 162
  Display Results 162
  The RSArray Class 167
  Class Definition 167
 
Chapter 5 JDBC Applet Example 177
 
  Overview 178
  Insert Data 179
  Get Data 179
  Next Row 179
  Previous Row 179
  Applet Code 180
  Declarations 180
  Display Applet Window 181
  ŒPrevious Row¹ Button Click Event Handler 181
  ŒNext Row¹ Button Click Event Handler 181
  ŒInsert Data¹ Button Click Event Handler 181
  Declarations 182
  Display Applet Window 183
  Button Class Declaration 186
  Previous Button Click Handler 188
  Insert Data Button Click Event 189
  NextRow Button Event 190
  Get Data Button Event 191
 
Chapter 6 Three-Tiered Application Demo 225
 
  Benefits of Three-Tiered Architecture 227
  The Java Remote Method
  Invocation (RMI) API 229
  Creating a RMI Application 231
  Three-Tiered Demo Application 232
  Client Applet Overview 223
  Server Application Overview 234
  Client Price Guide Applet 234
  RMI Server 249
  Complete Code Presentation 266
  CompApplet 266
  ClientHandler 283
  ServerHandler 285
  CompPrice 287
  ResultSetCopy 288
  ResultCopier 295
  Database 307
 
Part Two: JDBC Reference 322
 
Chapter 7 JDBC Quick Reference 325
 
  JDBC Methods Summary 325
  All JDBC Methods 326
  Class Variables 357
 
Chapter 8 JDBC Reference 325
 
  Interface java.sql.CallableStatement 363
  CallableStatement Methods 365
  Interface java.sql.Connection 375
  Connection Methods 379
  The java.sql.DatabaseMetaData Interface 394
  Instance Variables 394
  DatabaseMetaData Methods 402
  Class java.sql.DataTruncation 509
  DataTruncation Methods 509
  Class java.sql.Date 513
  Interface java.sql.Driver 514
  Driver Methods 515
  getPropertyInfo 516
  Class java.sql.DriverManager 518
  DriverManager Methods 519
  Class java.sql.DriverPropertyInfo 528
  Variables 529
  Constructor 529
  Class java.sql.NullData 530
  Variables 530
  Constructor 531
  Class java.sql.Numeric 531
  Constructors 531
  Numeric Methods 535
  hashCode 542
  Interface java.sql.PreparedStatement 550
  PreparedStatement Methods 552
  executeQuery 555
  Interface java.sql.ResultSet 584
  ResultSet Methods 586
  Interface java.sql.ResultSetMetaData 631
  ResultSetMetaData Variables 632
  ResultSetMetaData Methods 633
  Class java.sql.SQLException 659
  SQLException Constructor 660
  SQLException Methods 661
  Class java.sql.SQLWarning 664
  SQLWarning Constructor 666
  SQLWarning Methods 666
  Interface java.sql.Statement 669
  Statement Methods 670
  Class java.sql.Time 699
  Methods 699
  Class java.sql.Timestamp 701
  Timestamp Constructors 701
  Timestamp Methods 701
  Class java.sql.Types 705
 
APPENDIX A Functions 711
 
  Math Functions 711
  String Functions 712
  Date Functions 714
  Database Functions 715
 
INDEX 717
 




Return to top of page


[About the book][Table of Contents][Readme][JDBC links][What's on the CD][Ordering Info]

Home



© Prentice-Hall, Inc.
A Simon & Schuster Company
Upper Saddle River, New Jersey 07458

Legal Statement