Technical Support
Discussion Forum
Online Training
Read About Java
Java In-Depth
Product Discounts
Membership Information JDC Resources DukeDollars

Java Cup Logo

JDC Home Page

JDC Applets
(chat, newsreader, calendar)

Log Out

Online Training
shadowSearchFAQFeedback

Course Notes Table of Contents | Exercises
JDBC Short Course Index | Online Training Index

Command-Line Guestbook
Working Applet | Help
Solution

Prerequisites

Skeleton Code

A staff member at MageLang University decided to take the latest Java class. After getting her feet wet with JDBC, she thought it would be a great idea to keep a log of student comments regarding about the various courses she taught.

This exercise results in an application that tracks the comments received from the students in a three column table called comments (name, username, and comments).

The program will generate a report of the comments to deliver to student government and other interested parties.

To run the resulting program:

java Comments name username comments

You can repeat the set of three parameters as many times as you want to.

Perform the following tasks:

  1. Copy the odbc.datasource file from the previous exercise. And setup the Connection to the DriverManager.

  2. For update mode, use a PreparedStatement to accept groups of three parameters from the command line to insert a comment into the table.

  3. For query mode, you can use a regular Statement. Remember to use findColumn to determine which column is for which field.

  4. Close each statement.

  5. Close the connection.

The task numbers above are linked to the step-by-step help page. Also available is a complete solution, which meets these requirements, and Expected Behavior.


Copyright © 1997 MageLang Institute. All Rights Reserved
May-97 Copyright © 1996, 1997 Sun Microsystems Inc. All Rights Reserved