Tea plantations | Munnar, Kerala

Menu:

Course Homepage

Contact Information

TA: Mario Guajardo
Email: guajardo@cs.utexas.edu  (Please include "cs347 question" somewhere in the Subject line)

Office Hours Information

Office Hours:

Location: ENS 31NQ (enter via room 31NR)

The TA station where I hold office hours is a little difficult to find. So here are directions to get there:

- At the ENS building, take the elevator down to the basement (hit the "LB" key)
- As you exit the elevator, turn right into the hallway
- Keep going down the hallway until you see room 31NR on your left
- Go through this room to get to room 31NQ

Turning In Homework

To submit your homework or projects, use the turnin program from a command prompt on the Linux or Sun machines to submit to the TA. Example:

Submitting homework:

   turnin -submit guajardo homeworkN

Submitting projects:
   turnin -submit guajardo projectN

replacing "N" with the homework or project number.

Notes:

  1. Turnin is located in /lusr/bin; if that directory is not in your path, then call it as /lusr/bin/turnin.
  2. If you submit twice, the second one will entirely overwrite the first one. So don't submit any updates after the due date, or we will never know that you submitted the first version on time.
  3. After submitting everything, you should make sure that all of your files were transmitted properly using turnin's list feature:
             turnin -list guajardo homeworkN
  4. See the man page turnin(1) for more details. You can look at the turnin manpage by using the following command:
            man turnin

File Submission Format

The following instruction indicate the file format and expected output for each homework and project:

Homework 1 and 2

Please turnin the following files for this homework

IMPORTANT: Each scriptX.sql file should contain a "Rem Problem X" statement (where X is the problem number) before each problem's SQL command(s). For example, script1.sql should look like the following.

Rem Problem 1.1
DROP TABLE Programmer CASCADE CONSTRAINTS;
CREATE TABLE Programmer
  (EmpNo        Varchar2(3)     PRIMARY KEY,
  Last_Name     Varchar2(25)    NOT NULL,
  First_Name    Varchar2(25),
  Hire_Date     Date,
  Project       Varchar2(3),
  Language      Varchar2(15),
  TaskNo        Number(2),
  Clearance     Varchar2(25)
);

Rem Problem 1.2
INSERT INTO programmer
(EmpNo, Last_Name, First_Name, Hire_Date, Project, Language, TaskNo, Clearance)
Values('201', 'Campbell', 'John', '1-JAN-95', 'NPR', 'VB', 52, 'Secret');
...

Rem Problem 1.3
UPDATE programmer
SET clearance = 'Secret'
WHERE empno = '345';

Rem Problem 1.5

...

Rem Problem N

Similarly, output1.txt should look like the following:

DROP TABLE Programmer succeeded.
CREATE TABLE succeeded.
7 rows inserted
1 rows updated
...

Finally, to submit these files execute:

turnin -submit guajardo homework1 script1.sql output1.txt script2.sql output2.txt script3.sql output3.txt

Homework 3

Please submit either a MS Word (named "relational.doc") or PDF file (named "relational.pdf") with the relational algebra expressions. In MS Word, use the Equation Editor by selecting Insert/Object.../Microsoft Equation. You may use other packages (such as LaTex) as long as you use the correct symbols (pi, union, etc.) and appropriate subscripts. You may also write the solutions on paper, then scan them and produce a readable PDF file.

Use the following documents as example:

         turnin -list guajardo homework3 relational.pdf
or,
         turnin -list guajardo homework3 relational.doc

Homework 4

Please hand in in a printed HARD COPY of your homework to Prof. Batory during class this Thursday or drop it at homework drop-off box on Taylor breezeway by 5pm. on Thursday 4th. You can either type it our write it legibly by hand.

Project 1

Please turn in a HARD COPY of your project in the homework dropbox located in Taylor breezeway. Include a stapled package with the ER model of your schema with an accompanying explanation of your design decisions. Make sure your name, project number and course name are fairly visible.

Project 2

Updated 11/11/2007

== What to submit ==

All submissions are due Monday November 12, by 5pm.

Submit the following files ELECTRONICALLY via turnin:

   turnin -submit guajardo project2 BytecodeToSql.java
   turnin -submit guajardo project2 SCRIPT.sql

ALSO submit to the Taylor dropbox a HARD COPY of the following (stapled together with your name clearly written):
- The revised ER diagram
- A printout of BytecodeToSql.java source code

Updated: You do NOT need to submit a hardcopy of SCRIPT.sql anymore to save paper :)

== Grading Methodology ==

BytecodeToSql.java is a tool that will either internally parse all the text produced by ClassReader,or it will programmatically access ClassReader's API. Its only argument will be a path to the .class file that we want to read.

Your BytecodeToSql.java programs takes two arguments:

  java BytecodeToSql argument_1 argument_2

Where argument_1 points to the full path of the class to read (e.g., Add.class) and argument_2 is the name of the output file.

Output file note:
If the output file (e.g., SCRIPTgen.sql) does NOT exist, then BytecodeToSql should create a new file and this file should have an initialization section with the DROP TABLE, CREATE TABLE sql commands, followed by INSERT commands. If the output file already exists, then BytecodeToSql should open the file and append INSERT commands only (since we assume that the DROP TABLE, CREATE TABLE commands were already added when the file was initially created).

I am going to grade your BytecodeToSql.java script with the following sequence of commands. Make sure your script works correctly with this verbatim sequence of commands (note that the > and >> were removed:)

javac -classpath . BytecodeToSql.java
java -classpath . BytecodeToSql Add.class SCRIPTgen.sql
java -classpath . BytecodeToSql Exp.class SCRIPTgen.sql
java -classpath . BytecodeToSql Lit.class SCRIPTgen.sql
java -classpath . BytecodeToSql Neg.class SCRIPTgen.sql
java -classpath . BytecodeToSql Test.class SCRIPTgen.sql
java -classpath . BytecodeToSql ClassInfo.class SCRIPTgen.sql
java -classpath . BytecodeToSql ClassReader.class SCRIPTgen.sql
java -classpath . BytecodeToSql FieldInfo.class SCRIPTgen.sql
java -classpath . BytecodeToSql MethodInfo.class SCRIPTgen.sql

Then, I will compare SCRIPTgen.sql with your submitted SCRIPT.sql and I expect to see IDENTICAL files.

Updated: For each execution of BytecodeToSql I expect to see an output to the given file (e.g., SCRIPTgen.sql) with equivalent SQL commands (DROP TABLE, CREATE TABLE, INSERT, etc.) that will initialize the Oracle Database with the structure of the given class (e.g., Add.class, Exp.class, etc.). See the note avobe to see when to add DROP TABLE, CREATE TABLE commands.

== Grading breakout ==

I will assign the following percentages of your grade to the given items:
5 % If BytecodeToSql.java is electronically submitted via turnin. Update: You can assume I will have the directories ClassReader.jar and bcel.jar expanded in the directory from which I run your program.
5% If SCRIPT.sql is electronically submitted via turnin
5% If hard copies of ER diagrams and source code are stapled and submitted to dropbox in Taylor. Update: You do not need to submit a hard copy of SCRIPT.sql anymore to save paper.
5% If source code of BytecodeToSql.java has clear in-line comments and correct indentation.
20% If submitted revised ER diagram correctly reflects structure of generated SQL commands by BytecodeToSql and diagram is correct.
20% If BytecodeToSql correctly compiles with command "javac -classpath . BytecodeToSql.java"
40% If generated (by me) SCRIPTgen.sql file is identical to submitted (by you) SCRIPT.sql so make sure you generate SCRIPT.sql in the order I give avobe (Add.class, Exp.class, etc.)

== Notes on JDBC feature ==

The JDBC feature is optional for Project 2. If you want to submit it, I will not count it towards your grade but I will give you feedback about it.

If you choose to submit it for Project 2 submit it as follows:

   turnin -submit guajardo project2 SqlToOracle.java

This feature will be mandatory, however, for Project 3.

Homework 6

Please submit a HARD COPY of your answers to the questions for homework 6. Submit this homework in the Taylor homework dropbox by Monday December 3rd at 5:00pm.

Email me if you are using slip days for this homework so that I can go pick it up to the dropbox.

Project 3

== What to submit ==

Due Tuesday November 27th by 5pm.

Submit the following files ELECTRONICALLY via turnin:

   turnin -submit guajardo project3 SqlToOracle.java
   turnin -submit guajardo project3 QueryPrompt.java
   turnin -submit guajardo project3 SCRIPT.sql

== Grading Methodology ==

This homework is required to run in Java 1.5 that can be found in any CS linux machine in /lusr/java5/bin/javac and /lusr/java5/bin/java.

SqlToOracle.java should take 4 arguments in the following order: dburl, user, password, sqlfile. Namely, your program should be able to compile and run in any CS linux machine as follows:

  /lusr/java5/bin/javac -classpath ojdbc5.jar SqlToOracle.java
  /lusr/java5/bin/java -classpath ojdbc5.jar:. SqlToOracle oracle.microlab.cs.utexas.edu:1521:orcl yourusername yourpassword SCRIPT.sql

Similarly, QueryPrompt.java should take 3 arguments in the following order: dburl, user, password. Namely, your program should be able to compile and run in any CS linux machine as follows:

  /lusr/java5/bin/javac -classpath ojdbc5.jar QueryPrompt.java
  /lusr/java5/bin/java -classpath ojdbc5.jar:. QueryPrompt oracle.microlab.cs.utexas.edu:1521:orcl yourusername yourpassword

SCRIPT.sql is the file that SqlToOracle.java will take and it contains the set of SQL commands to initiallize the database. That is, the union of the data from ClassReader.jar and EPL.jar, which you formed in the last assignment.

JDBC library

You can download the Oracle JDBC driver here ojdbc5.jar. It runs with Java 1.5.

== Sample Files ==

The following files show a way of retrieving the command-line arguments in the order required (dburl, user, password, etc.) as well as showing basic JDBC functionallity:
SqlToOracle.java
/* Project 3
 * Name: YOUR NAME
 */
import java.sql.*;
public class SqlToOracle {
	public static void main(String[] args) {
		try {
			String dburl = args[0];
			String user = args[1];
			String password = args[2];
			String sqlfile = args[3];
			
			DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@"+dburl, user, password);
			/* TODO: Fill-in this part with the code that reads the 
			 * SQL commands contained in the "sqlfile" and stores
			 * them in the Oracle database.
			 *
			 */ 
			conn.close();
		} catch (Exception e) { 
			System.out.println("ERROR : " + e);
			e.printStackTrace(System.out);
		}
	}
}
QueryPrompt.java
/* Project 3
 * Name: YOUR NAME
 */
import java.sql.*;
public class QueryPrompt {
	public static void main(String[] args) {
		try {
			String dburl = args[0];
			String user = args[1];
			String password = args[2];
			
			DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@"+dburl, user, password);
			/* TODO: Fill-in this part with the code that prints the
			 * menu with the list of queries, asks the user for the
			 * query number and parameter(s), executes the query and prints
			 * out the result.
			 */
			
			/*
			 * Statement stmt = conn.createStatement();
			 * ResultSet r = stmt.executeQuery ("SELECT * FROM ...");
			 *
			 * ...
			 *
			 * stmt.close();
			 *
			 * ...
			 */
			
			conn.close();
		} catch (Exception e) { 
			System.out.println("ERROR : " + e);
			e.printStackTrace(System.out);
		}
	}
}

== Grading breakout ==

I will assign the following percentages of your grade to the given items:

== Expected Menu ===

For QueryPrompt.java, you are excpected to produce a menu like this with the given 10 queries. The following also shows a sample user interaction where the users selects to execute query 8 and enters "Exp". Then the user decides to quit.
    1. what are the ____  methods defined in a class ____ ?
    2. what (method, class) pairs reference method ____ of a class ____?
    3. in which package(s) is class ____ defined?
    4. in what methods is variable ____ referenced?
    5. what variables does method ____ reference?
    6. what methods does method ____ reference?
    7. what classes does class ____ reference?
    8. What are the subclasses of class ____?
    9. What variables may be referenced when method ____ is invoked?
    10. What methods may be referenced when method ____ is invoked?
 
    Enter a query number or type "q" to quit: 8

    What are the subclasses of class:  Exp

    Result:
    [Print the actual query result here ...]  

    1. what are the ____  methods defined in a class ____ ?
    2. what (method, class) pairs reference method ____ of a class ____?
    3. in which package(s) is class ____ defined?
    4. in what methods is variable ____ referenced?
    5. what variables does method ____ reference?
    6. what methods does method ____ reference?
    7. what classes does class ____ reference?
    8. What are the subclasses of class ____?
    9. What variables may be referenced when method ____ is invoked?
    10. What methods may be referenced when method ____ is invoked?
    
    Enter a query number or type "q" to quit: q

Project 4

IMPORTANT: Please use the shared Google document to sign-up (email me if you need the link.). See calendar avobe for time/date of the demo sessions I will hold.

You can either demo your project on the UTCS lab machines in 31NQ or you can bring your own laptop.

Please come a bit earlier so that you can have your demo ready by the time it is your turn.

Please submit an electronic copy of your code and a README file by the project deadline (Friday Dec. 7th 5pm) and you are allowed to use up to two slip days. The README file should include instructions for compiling and executing your program as well as an explanation of the APIs, libraries and/or technologies/platforms used.

Late Submission Policy (Updated 10/22/07)

No assignment (homework or project) may be more than 2 days late. You will have 6 free late (slip) days in 1 day units (1 minute to 24 hours = 1 day) for all the assignments during the semester. You may divide your slip days across the assignments in any way you wish to extend deadlines, subject to the 2 day maximum per assignment. To help the TA track your slip-day status, if you submit a late assignment email the TA with the following information within 12 hours of submitting the assignment:

Assignment number: _____
Slip days used (this assignment:) _______
Slip days used (total): ______