Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 
Training Index

JDBC Short Course
JDBC Exercises

by Magelang Institute

[Table of Contents]

Welcome to the JDBC exercises. These exercises show how to use JDBC to connect to a relational database, how to send SQL queries to the database and how to collect and process the results of a query. There are also exercises on how to look at the metadata of a database (the structure of the tables in the database) and how to use sockets to allow communication between a secure applet and a remote database.

There are nine exercises to complete:

  1. Getting Started
    This exercise shows how to create a data source to use with ODBC.

    Educational goals:

    • Learn about different types of ODBC datasources.
    • Learn how to create an ODBC datasource.

  2. JDBCTest Introduction.

    This exercise shows how to use the JDBCTest application to test the JDBC-ODBC bridge.

    Educational goals:

    • Learn about JDBC drivers.
    • Learn how to use JDBCTest to get metadata from the database.

  3. Connecting to an ODBC datasource without JDBCTest.

    This exercise shows how to connect to an ODBC data source using only Java code.

    Educational goals:

    • Learn how to load a JDBC driver in Java.
    • Learn about the Java DriverManager class.

  4. Connecting with Properties.

    This exercise shows how to connect to a database using properties.

    Educational goal:

    • Learn how to change datasources without recompiling.

  5. Selecting.

    This exercise shows how to execute SQL statements, and use the results to build a chart.

    Educational goals:

    • Learn how to execute a SQL select statement.
    • Learn how to process the results of a database query.
    • Learn to use the NetCharts package to build a chart.

  6. Using MetaData.

    This exercise shows how to get information about the structure of a database.

    Educational goals:

    • Learn how to get database metadata from the results of a query.
    • Learn how to process the database metadata.

  7. Command-Line Guestbook.

    This exercise, builds a simple application that operates as a guestbook, allowing users to enter new comments and view previous comments.

    Educational goals:

    • Learn how to execute SQL select statements.
    • Learn how to use the findColumn method.
    • Learn how to execute a prepared SQL update statements.

  8. Applet Guestbook.

    This exercise, an extension of the previous one, adds an applet to present a GUI interface to the guestbook.

    Educational goal:

    • Learn how to use sockets to connect an Applet safely to a remote database.

  9. SQL Warning/Exception Handling.

    This exercise deals with something we've been mostly ignoring in all the other exercises, warnings, exceptions, and errors.

    Educational goals:

    • Learn how to detect and handle runtime SQL warnings and exceptions.
    • Learn how to use DatabaseMetaData to avoid some of them.

Copyright © 1996 MageLang Institute. All Rights Reserved.

Print Button
[ This page was updated: 21-Sep-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary | Feedback | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.