Sun Java
  • Java Developer Tools

    See and download all software tools available from Sun.

  • Java Standard Edition

    For developing and deploying Java applications for the desktop, servers, embedded, and real-time environments.

  • Java Enterprise Edition

    For enterprise, server-side Java applications.

  • Java Micro Edition

    For Java applications running on mobile devices.

  • Java Training

    Sharpen your Java skills with courses from the source.

  • Java Support

    Get dedicated help from Sun including technical assistance, product support, and support for deployed Java applications.

  • OpenSolaris

    Download, develop and collaborate with OpenSolaris

  • Solaris

    Download the most advanced operating system in the world

  • Sun Studio

    Optimizing compilers and tools for C/C++/Fortran application development

  • Solaris Developer Center

    Explore the resources and community available to the Solaris developer.

  • Sun Developer Services

    Get technical assistance, product support, training, and other services from the source.

  • BigAdmin

    A community site with Solaris system administration information, hardware compatibility, a script library, and other resources for administrators of Sun products.

Communities My SDN Account
Tutorials & Code Camps

jGuru: JDBC 2.0 Fundamentals


About This Short Course

[Short Course| Exercises]

The Sun Developer Network presents a Short Course on JDBC technology written by jGuru (formerly named the MageLang Institute).

jGuru has been a regular contributor to the JDC since 1996 and is dedicated to promoting the growth of the Java technology community through evangelism, education, and software. You can find out more about their activities, including community-driven FAQs and online learning, at

Please send comments about the course to

This module introduces the fundamental concepts of JDBC and gives you a working knowledge of the major elements of the core JDBC 2.0 API. The course is standards-based and uses best practices to demonstrate How-Tos useful to the field developer.


After completing this module you will understand:

  • The rationale for the JDBC API
  • The fundamental concepts involved in database and JDBC applications
  • How JDBC classes work together to connect to and communicate with a database
  • A number of intermediate-level JDBC and database concepts
  • How to use selected capabilities new in JDBC 2.0


By the end of this module you will be able to:

  • Create and alter database tables
  • Access and modify data contained in a database
  • Dynamically discover information about a database and retrieved data
  • Properly handle errors and exceptions in a JDBC application
  • Use prepared statements
  • Treat multiple operations on a database as a single transaction
  • Work with batch updates and scrollable ResultSets
  • Use BLOBs to store and retrieve images and other binary data


A familiarity with object-oriented programming concepts in general and the Java programming language in particular is expected. If you are not familiar with these capabilities, see:

The exercises in the JDBC tutorial require you to understand, modify, and build Java programs at approximately the intermediate level, although complete solutions are always given. In addition, the reader should have at least a minimal understanding of Relational Database Management Systems (RDBMS) and Structured Query Language (SQL). The SQL Primer and Resources sections of the Appendices contain information, links, and book references to help provide this background.

Required Software

Cloudscape, a 100% Pure Java SQL DBMS available in the Java 2 Platform, Enterprise Edition (J2EE) download, is used to support most of the exercises in the course. With minor modifications, the exercises run against any database with a JDBC Compliant driver. If you do not have a readily available DBMS, please see the Appendices topics Cloudscape Installation and Setup and Starting and Stopping Cloudscape.

JDBC is one of the few areas of the Java programming language that depends on external implementations and vendor-specific products. While the course focuses on standard JDBC, this is a fact of life that cannot be escaped. For that reason, you will occasionally notice comments directed towards a particular DBMS used in the discussion. These will generally be prefaced with the following symbols:


This is Cloudscape specific information.


This information is specific to IBM's DB2. In the course:

  • DB2 Universal for NT is referred to as UDB2/NT
  • DB2 on the AS/400 is referred to as DB2/400

Cloudscape is a trademark of Informix. DB2 is a trademark of IBM.

Use or non-use of a particular DMBS, tool, or product in this course does not imply any sort of recommendation for or denigration of the particular product. For further information on the database choices made for this course, read Searching for a Database, Autumn, 2000 at jGuru.

About the Author

Joe Sam Shirah is the owner of Autumn Software and a principal at conceptGO, both of which provide consulting, development, outsourcing, training, testing, and other services as well as software products. Joe Sam is a past recipient of the Java Community Award, and has been the jGuru manager for the JDBC, Internationalization, and Java400 FAQs.


Special thanks to Java guru John Zukowski for editing the course, contributing the SQL Primer section, and providing the JSP-related portions of the Using JDBC with JavaServer Pages topic.

Start the Short Course

Copyright 1996-2000 All Rights Reserved.

Have a question about programming? Use Java Online Support.

Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.