C20.0046 - Spring, 2005 - Johnson
Homework 3
Due: 11:59pm, Sunday, 4/24

Important things to remember:

  1. Typing is not required, but solutions must be legible to be graded.
  2. Neither collaboration nor use of unapproved sources is allowed and will be considered cheating.
  3. If you get stuck, ask for help!

The number of points for each problem is indicated in parentheses.

  1. (5) Give two reasons why you'd want to compute prepared, parameterized queries. Explain.
  2. (25) Exercise 5.4 parts 3,4,5,6,8.
  3. (20) In this problem, you'll create a (very) simple character-based DB application with Oracle and Java JDBC (or, if you prefer, with Pro*C). Even if you don't know Java (well), by following the example this problem should turn out to be pretty easy. If you get an error, do a websearch for th error message. And if you get stuck, ask for help.

    First, log into your Oracle account (with the login info recently emailed) and create a small, populated table of your choice--one with at least 3 or 4 fields and with at least 5 rows (info on the books you read this semster, and your ratings of them, say). You'll turn in a transcript of the table creation.

    Now you'll write a simple Java program that, when run, connects to the database and prints the contents of your table. Of course, we already have a program that does something quite similar--SQLRunner connects to *my* account, runs an arbitrary query, and prints the results.

    To write your program, first copy my SQLRunner over from my directory (~mjohnson/dbms/eg/lec18/SQLRunner.java and the helper class ~mjohnson/dbms/eg/lec18/SQLUtil.java), and try compiling and running, as demonstrated in Lecture 17. Now modify the program slightly so that it 1) connects to your account and 2) runs the query described above instead of accepting a command-line parameter. That's it!

Emailed deliverables:

  1. responses to questions 1 and 2
  2. the transcript of your table creation
  3. your final Java sourcecode
  4. a screenshot (copied-and-pasted text) of your program being run and producing output

mjohnson-at-stern.nyu.edu