CS145 Assignment #7
Due 2:45PM, Thursday Dec. 4, 2003
Finale (7) 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
to Oracle Pro*C
available to give you the basics of this facility.
Also useful are the sample programs in
(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
An option is to build a Web interface, and if you do so, the
Guide is what you need to look at.
Your program should consist of a continuous loop in which:
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
- 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
- The system accesses the database to perform the
appropriate queries and/or modifications.
- Data or an appropriate acknowledgment is returned to the user.
Look up the price of a given beer at a given bar.
Find the bar with the lowest price for a given beer.
Given a drinker, find all the other drinkers that frequent at least one
bar in common.
Add a new beer to the Beers relation.
Increase all the prices at a given bar by a given amount.
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
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.