Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

Command-Line Guestbook

 

Training Index


[Table of Contents]

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 © 1996 Magelang Institute. All Rights Reserved.