Course Catalog
Curriculum Guides
  .NET
  Java/J2EE
  XML
Downloads
Buy Courseware
Customization
News
Authors
Technical Library
FAQ
About Object Innovations
Opportunities
Contact Us
Home

 

 

   
www.objectinnovations.com
info@objectinnovations.com
877-558-7246 (toll free)  
781-466-8012  

168.  JDBC Programming

Rev. 5.0

 

This course is now available directly from our partner, Capstone Courseware.

This one-day course covers the fundamentals of database programming in Java using JDBC (Java Database connectivity) in an incremental fashion, to get the programmer up to speed quickly and then to layer a deeper understanding of JDBC upon that foundation.  This course has been designed to work with any of these relational database management systems:

 

·         Apache Derby, version 10.1

·         MySQL, version 4.1

·         PostgreSQL 8.0

·         Oracle, version 9i or 10g

 

Lab exercises use SQL99 constructs whenever possible in order to be relevant to databases from all vendors.  The course software also includes an optional overlay of workspace and project files to support use of the Eclipse IDE in the classroom.  (This requires that the instructor be experienced in use of Eclipse and able to walk students through basic tasks in the IDE.)

 

This revision of the course targets the 5.0 version of the Java language and Core API, though the impact of choosing a 1.4.x or 5.0 Java environment is minimal for this level of JDBC study.  For training targeted to the 1.4 environment, please see version 4.5.1 of this course; to read more about different versions of Java and for help deciding on which version of this course to use, see “Java Versions and Terminology Demystified”.

 

LEARNING OBJECTIVES

 

·         Briefly review relational database fundamentals with an awareness of the differences between SQL99 and SQL implementations by database vendors.

·         Connect to a database using JDBC and perform a simple query.

·         Update relational data using JDBC to execute updates, inserts and deletes.

·         Use prepared statements to produce reusable database queries and optimize execution time. 

·         Use callable statements to access database procedures. 

·         Use scrollable and updatable results sets for more robust solutions.

·         Use commit, rollback, and savepoint to build transactional systems.

·         Use batch processing for efficient handling of large datasets. 

·         Understand the use of RowSets and the improved techniques and portability that they bring to JDBC.

 

Course Duration: 1 day

 

Prerequisites: 

 

·         Experience in Java Programming is essential.  The student must be comfortable with object-oriented Java, interfaces and abstract classes.  Object Innovations Course 103, “Java Programming,” is excellent preparation.

·         Understanding of basic SQL usage or other work with relational databases will be helpful, but is not required.

 

1.      Database and SQL Fundamentals

Relational Databases and SQL

SQL Versions and Code Portability

Database, Schema, Tables, Columns and Rows

DDL – Creating and Managing Database Objects

DML – Retrieving and Managing Data

Sequences

Stored Procedures

Result Sets and Cursors

Using SQL Terminals

 

2.      JDBC Fundamentals

What is the JDBC API?

JDBC Drivers

Making a Connection

Creating and Executing a Statement

Retrieving Values from a ResultSet

SQL and Java Datatypes

SQL NULL Versus Java null

Creating and Updating Tables

Handling SQL Exceptions and Proper Cleanup

Handling SQLWarning

 

3.      Advanced JDBC

SQL Escape Syntax

Using Prepared Statements

Using Callable Statements

Scrollable Result Sets

Updatable Result Sets

Transactions

Commits, Rollbacks, and Savepoints

Batch Processing

Alternatives to JDBC

 

4.      Introduction to Row Sets

Row Sets in GUI and J2EE programming

Advantages of RowSets

RowSet Specializations

Using CachedRowSets

Appendix A. Learning Resources

Appendix B. Course Schema

Appendix C. Methods and Types

 

System Requirements

Hardware – minimal:                     Pentium 500 MHz, 256 MB RAM, 500 MB disk.

 

Hardware – recommended:           Pentium 1.5 GHz, 512 MB RAM, 1 GB disk.  For Oracle systems, significantly better processing power and memory is recommended – see Oracle’s own documentation for this.

 

Operating system:                          Tested on Windows 2000 and XP Professional editions.  The course software should be viable on all Windows or Linux systems that support J2SE 5.0.

 

Software:                                       All free downloadable tools, with an option to use certain commercial products.  The course supports the following database software:

 

·         Apache Derby 10.1 (formerly Cloudscape) – this product is included with the course software and is the default

·         MySQL 4.1 – this is a free downloadable and the Connector/J driver is included with the course software

·         PostgreSQL 8.0 – this is a free downloadable and the JDBC driver is included with the course software

·         Oracle 9i or 10g – no license or software is included with the course