Download Document

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft Access wikipedia , lookup

Business intelligence wikipedia , lookup

Serializability wikipedia , lookup

Data vault modeling wikipedia , lookup

Metadata wikipedia , lookup

Expense and cost recovery system (ECRS) wikipedia , lookup

SQL wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Database wikipedia , lookup

Concurrency control wikipedia , lookup

PL/SQL wikipedia , lookup

Versant Object Database wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Transcript
Building Database Client
Applications Using JDBC 2.0
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 1:
Introduction
to JDBC
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
•
•
•
•
•
Describe the purpose of JDBC
Discuss the structure of a relational database
Describe the purpose of SQL
Discuss the client-server architecture
Describe the JDBC architecture
JDBC—The Basics
• Sun Java database access API
• Microsoft Open Database Connectivity
Relational
Databases
• Database management systems
• Primary keys
• Joins
Structured
Query Language
•
•
•
•
DDL
DML
DCL
SQL data types
System
Architecture
• Client/server architecture
• Three-tier architecture
Summary





Describe the purpose of JDBC
Discuss the structure of a relational database
Describe the purpose of SQL
Discuss the client-server architecture
Describe the JDBC architecture
Lesson 2:
Using JDBC Drivers
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
•
•
•
•
Describe the various types of JDBC drivers
Select a JDBC driver
Load a JDBC driver
Establish a connection with a database
JDBC
Drivers
•
•
•
•
•
JDBC-ODBC bridge driver
Native-API driver
JDBC-Net driver
Pure Java driver
Loading a driver
Establishing
a Connection
• JDBC URLs
• The Connection interface
Summary




Describe the various types of JDBC drivers
Select a JDBC driver
Load a JDBC driver
Establish a connection with a database
Lesson 3:
Executing SQL Statements
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
•
•
•
•
•
•
Define tables in a database using JDBC
Add new rows to a table using JDBC
Perform queries on a database using JDBC
Extract data from a ResultSet object
Describe the purpose of transactions
Use transactions to maintain data consistency
The
Statement Interface
• Statement interface methods
• executeUpdate
• executeQuery
Transactions
Using SQL Statements
• Allow you to group statements so that
changes do not take effect until both tables
are updated
Summary






Define tables in a database using JDBC
Add new rows to a table using JDBC
Perform queries on a database using JDBC
Extract data from a ResultSet object
Describe the purpose of transactions
Use transactions to maintain data consistency
Lesson 4:
Prepared Statements
and Stored Procedures
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
• Describe the purpose of prepared statements
• Use prepared statements to increase
efficiency
• Describe the purpose of stored procedures
• Use stored procedures
Prepared
Statements
• PreparedStatement interface
• Prepared statement parameters
• Executing prepared statements
Stored
Procedures
• Precompiled
• Stored within the DBMS
• Remain permanently within the DBMS
Summary
 Describe the purpose of prepared statements
 Use prepared statements to increase
efficiency
 Describe the purpose of stored procedures
 Use stored procedures
Lesson 5:
Metadata
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
• Describe the purpose of metadata
• Extract metadata from a DBMS or database
• Extract metadata from a result set
Introduction
to Metadata
• Metadata: data about data
DatabaseMetaData
• Determining DBMS product information
• Determining supported features
• Determining the database schema
ResultSetMetaData
• Extracting metadata from a result set
Summary
 Describe the purpose of metadata
 Extract metadata from a DBMS or database
 Extract metadata from a result set
Lesson 6:
SQLExceptions
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
•
•
•
•
Describe the purpose of SQLExceptions
Catch SQLExceptions
Determine the cause of a SQLException
Recover efficiently from a SQLException
Introduction
to SQLExceptions
• SQLException class helps determine when an
error occurs and what type of error has
occurred
try and
catch Blocks
• catch block accepts an exception and
provides some handling for recovering from
an exception
• try block may have multiple associated
catch blocks
SQLException
Methods
•
•
•
•
String getMessage( );
String getSQLState( );
int getErrorCode( );
SQLException getNextException( );
Summary




Describe the purpose of SQLExceptions
Catch SQLExceptions
Determine the cause of a SQLException
Recover efficiently from a SQLException
Lesson 7:
Scrollable and
Updateable Result Sets
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
• Describe the purpose of scrollable result sets
• Create and use a scrollable result set
• Describe the purpose of updateable result
sets
• Create and use an updateable result set
Scrollable
Result Sets
• Creating a scrollable result set
• Result set type constants
• Scrolling through a scrollable result set
Updateable
Result Sets
•
•
•
•
Creating an updateable result set
Updating a result set
Inserting a row
Deleting a row
Summary
 Describe the purpose of scrollable result sets
 Create and use a scrollable result set
 Describe the purpose of updateable result
sets
 Create and use an updateable result set
Lesson 8:
Batch Updates
Copyright © 2002 ProsoftTraining. All rights reserved.
Objectives
•
•
•
•
Describe the purpose of batch updates
Perform a batch update
Perform a parameterized batch update
Catch a BatchUpdateException
Introduction
to Batch Updates
• Using batch updates
– addBatch
– executeBatch
– clearBatch
Parameterized
Batch Updates
• Combine the benefits of batch updates with
those of prepared statements
The
BatchUpdateException Class
• Performing batch updates
Summary




Describe the purpose of batch updates
Perform a batch update
Perform a parameterized batch update
Catch a BatchUpdateException
Building Database Client
Applications Using JDBC 2.0





Introduction to JDBC
Using JDBC Drivers
Executing SQL Statements
Prepared Statements and Stored Procedures
Metadata
Building Database Client
Applications Using JDBC 2.0
 SQLExceptions
 Scrollable and Updateable Result Sets
 Batch Updates