CS 4604 Course Project: Step 7

Date Assigned: Nov 22, 2002

Date Due: Dec 11, 2002, by midnight

The goal of this step of the project is to interface your DB with a PL and to make it web-accessible. This is the stage where you embed your database into a complete application (we add the web twist to make it more interesting). We will also have a `Best Project of the Year' award, where the best team will win a surprise gift and automatic membership into the CS4604 hall of fame!! :-)

The programming language that we will use is PHP (the DB is, of course, ORACLE), a server-side scripting language which is very similar to Perl. Executable commands are embedded via special tags in the web page source so that there is no need for any special setup. The official web page for PHP is here and it has been installed in the lab to facilitate this step of the project. By this facility, the ORACLE database that you have created can be accessed via the web, using a special server that has been installed for us. At this point, it is helpful to answer the following FAQs:


FAQ: Can we do this step of the project from our home computer/web server that we run off a different machine?

Answer: NO. Due to security constraints, we cannot provide a facility where you can access ORACLE from outside the confines of the special web server that we run for this course. If you do want to use your own web server etc., you should run the database system too and take care of everything yourself.

FAQ: Oh.... so, it is okay if we take care of everything ourselves? Can we use MySQL/Access/substitute-your-favorite-database-here with our application then?

Answer: Yes, you are welcome to do the project completely on your home computer. Notice that this involves having a DBMS (Oracle (no, we don't have licenses for home use), MySQL etc.), drivers for interfacing procedural calls (e.g., an ODBC interface or some other native implementation), being net-accessible (i.e., people can access web pages that are stored in your computer, via the world wide web). In addition, you probably need to install PHP (if you decide to toe the general project route), and maybe a web server that you can operate on your computer and network via some connection (i.e., if you are not already on some network). In short, if your setup allows the facility to create web pages and make them publicly accessible on the Internet, you are in good shape. If you choose this option, notice that you take full responsibility for ensuring that your machine supports all the desired functionalities and then start working on the project. "We were unable to install this on our machine", "We are getting a general protection fault at ...", "The network connection is broken and we cannot demo our project" etc. will not be valid reasons for requesting an extension. Please note that we provide this option for your convenience, so that you can take advantage of any already existing setup for your project. Do not attempt this unless you are absolutely positively sure what you are doing. Again, we do not have the resources or the manpower to provide technical support and help in debugging; At the end of the day, you just turnin the URL for your project (like everybody else), we will grade it just like every other project.

FAQ: Can we use ASP/substitute-the-latest-buzzword-here/ substitute-the-latest-coolest-stuff-here for the project?

Answer: Again, yes you may; and again you are on your own. We do not have facilities to support this in the lab, nor to provide technical support.

FAQ: What version of PHP is available in the lab?

Answer: PHP 4.2.3.


Preparatory Steps:
Place all your scripts and files inside the group directory.
Some how-tos of scripting

You can use native Oracle API (OCI) calls from your PHP program to access the database. Here's a sample PHP script illustrating the basic idea (this was also explained in the lecture class on Wednesday, Nov 20, 2002). There are two parts to this file, the top portion shows how to use the Oracle Calling Interface (OCI) functions to access a table, and the bottom portion shows such database calls can be embedded in a HTML document. When using the HTML portion, put a "<html><body>" in the beginning of this file and put a "</body></html>" at the end of this file, to make it a regular HTML file (of course, remove the top portion). You will also need to save this file with a ".php" extension, not a ".txt" extension. 

Make sure the following line is added in your program:

putenv("ORACLE_HOME=e:\oracle\ora81"),

and note that the database connect string is 'CS4604'.

And yes, you have to type in your password in these programs! :) Once you are all setup, the URL to access your web-database would be:

http://bulldog/<group name>/<starting PHP filename>

where group name is something like User1, User2, etc. and starting PHP filename is the "top-level" PHP script (like sample.php above); of course, you know that the < and > symbols should not be typed.


PHP Help

Keep in mind that the above sample script illustrates only the most common functions you will need to use, i.e., ocilogon, ociparse, ociexecute, ocifetch, and ociresult. There are many more functions that you can use, if you so desire. Here are some good documentation resources: You will find that the first resource also has a cute newsgroup type facility with lots of pertinent comments. When experimenting, you might notice that some PHP calls do not work as reported in the PHP documentation. This is due to some driver conflicts. The top level for the PHP documentation (including everything) can be found here.

Style Guide for your Application

What we want to see at the end of the day is one single web page, that provides a nice interface to your database. If you want to do more fancy and creative things, that is fine but proceed so only after completing this "core" requirement. A style guide for what this page should look like is given here. If you look at the template carefully, we are not doing any inserts, updates or deletes; just simple querying. That's one direction to look for, if you are aiming to be creative.


What you should turnin:

One team member from your project should send the URL for your web page from where we can access your application. This can be done by sending email to fmin@vt.edu. Notice that this URL could be located on the cslab server or on some server that you run yourself. If it is on the cslab (bulldog) server, remember that security considerations prevent your URL from viewing outside this domain. But for grading purposes, it doesn't matter since we will do this within the domain. This point is just mentioned so that you realize you cannot "advertise" this URL outside our domain. If you choose the latter option, then it is your responsibility to make sure that the server is up and running when we try to access your web page.

In addition, you need to compile a short project report (about 6-8 pages); more on this below.


What your project will be graded for:

Here's the distribution of points:

  1. (50 points) If everything works fine and all the buttons and links that we click indeed do what they are expected to do. We will see if you are really accessing the database dynamically and are not just "looking up" the data from some ready made source. This we will ensure by typing ad-hoc queries. You will also need to make sure that all query results have column names neatly presented and that data is clearly tabulated.

  2. (25 points) Explain if somebody who is really in the domain of your application would use your web-enabled database or if there is something missing or intrinsically complex that will deter them from using it. For example, if you are in the books domain, see if a bookseller would use your database; is there something that they will particularly like, (or dislike?) It would be ideal if you had access to a real application domain person, you can just ask him/her to try your web URL out and give you feedback! Else, just look at "similar" systems or web pages and see if they are doing something differently and if your approach is better (or worse) and why.

    Please note that there is no "right" answer to this question nor will you be penalized for saying that there is something missing from your project. What we want to see is if you can discuss the implications of your system for the application domain that you have chosen.

  3. (20 points) A project report where you summarize all steps of your project in a single document. If possible, include snapshots of your web interface. This report can be easily created by cut-and-pasting all the previous reports that you submitted, making sure you include the E/R diagram, the stuff about normalization, and about queries. Also include the role of each team member in the project. Clearly identify the scope of everybody's contribution. If there were any problems during the course of the project (due to less than complete participation by some team member), identify them. Also include your answer for question 2 above.

    Prepare your report in PDF (Portable Document Format) format (please, I am sitting on a UNIX machine and cannot read Word documents)!!

    You do not need to submit your report separately; just link it from the web page that you turnin from which we can download it. No need to present hard copies. We want a soft copy because we want to link all these up from the course web page at the end of the semester. Notice that this is also the stage where your group can show your creativity etc.

  4. (5 points) Neatness, presentation, style, consistency etc.

How to earn more points (and get the BPOTY award!)

Here are directions to try: Again, these are just a sampler. But you get the picture! Include these in your project report when you submit it in PDF form.