CS145 Assignment #6

Due 2:45PM, Thursday Dec. 2, 2004

Finale (6) of Your PDA

The PDA part is to build a "user-friendly," interactive application program front end to your PDA using the C or C++ programming language and embedded SQL. There is a Guide to Oracle Pro*C available to give you the basics of this facility. Also useful are the sample programs in /afs/ir/class/cs145/code/proc. (People who are inexplicably busy this time of year often snarf code from one or more of these samples and use them as the basis for their program. This approach is OK, as long as you acknowledge your source, as should always be the case.)

Alternatively, you may write in Java and use the JDBC interface between Java code and SQL code. The on-line place to look is the Oracle JDBC Guide.

An option is to build a Web interface, and if you do so, the Web-Interface Guide is what you need to look at.

Your program should consist of a continuous loop in which:

A list of at least five alternative options is offered to the user. An additional alternative should be quit.
The user selects an alternative.
The system prompts the user for appropriate input values.
The system accesses the database to perform the appropriate queries and/or modifications.
Data or an appropriate acknowledgment is returned to the user.

You should include both queries and modifications among your options. For example, if your PDA were about bars, beers, and drinkers you might offer options such as
  1. Look up the price of a given beer at a given bar.
  2. Find the bar with the lowest price for a given beer.
  3. Given a drinker, find all the other drinkers that frequent at least one bar in common.
  4. Add a new beer to the Beers relation.
  5. Increase all the prices at a given bar by a given amount.
  6. Quit.

We are not expecting anything fancy in the way of interface. For example, if you do not use a Web form, then a menu printed via printf is OK.

Also, handling of SQL errors can be quite simple. Either write an sqlerror routine that just prints the error message from Oracle or copy the error handler from a sample program.

Submit your program and a script showing the program running. Each of the options should be exercised at least once in your script.

However, if you build a Web interface to your database that allows the sorts of options described above, then please submit your code, the URL, and some sample data values that will give nontrivial responses to your queries (because otherwise we may not be able to guess that "xyz" is the name of a bar generated by your random-data generator from PDA-3). Your project should be kept on some server that is normally available, such as with your Stanford home page if you have one, since a TA will try out your project at some time we cannot predict.