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:
- 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.
- 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.
- 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.
- Connecting with Properties.
This exercise shows how to connect to a database using properties.
Educational goal:
- Learn how to change datasources without recompiling.
- 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.
- 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.
- 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.
- 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.
- 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.
|