Upload
patrick-mason
View
216
Download
0
Embed Size (px)
Citation preview
Movie ManagerMovie Managerby by
Patrick Wesley Patrick Wesley and and
Chris GreyChris GreyInternet Database ProjectInternet Database Project
forforCS 8630 – Summer 2004CS 8630 – Summer 2004
Dr. GuimaraesDr. Guimaraes
IntroductionIntroduction We set out to Create a Web based Management We set out to Create a Web based Management
Application for our Home Movie Collections that Application for our Home Movie Collections that would:would:
- Maintain a movie inventory- Maintain a movie inventory- Track movies loaned to friends and familyTrack movies loaned to friends and family- Store information about our movie collectionStore information about our movie collection- Store contact information for loaned moviesStore contact information for loaned movies- Publish our collection to the Web so family and Publish our collection to the Web so family and
friends can see what they can borrowfriends can see what they can borrow
Technologies UsedTechnologies Used
Oracle 9i Personal EditionOracle 9i Personal EditionJava Database Connectivity (JDBC)Java Database Connectivity (JDBC)Apache Tomcat – Web ServerApache Tomcat – Web ServerJava Server PagesJava Server PagesHTMLHTMLSQLSQL
The Application was Created by:The Application was Created by:
Gathering Specifications Gathering Specifications Creating an E-R DiagramCreating an E-R DiagramCreating a Relational SchemaCreating a Relational SchemaCreating the Tables in OracleCreating the Tables in OracleDeveloping Java Server PagesDeveloping Java Server PagesDeploying JSP in Apache TomcatDeploying JSP in Apache TomcatUsing and testing the ApplicationUsing and testing the Application
Specifications Were Gathered by:Specifications Were Gathered by:
Generating ideas on the Application’s usesGenerating ideas on the Application’s usesDiscussing the functionalityDiscussing the functionalityDiscussing the information we wanted to Discussing the information we wanted to
store store Documenting and compiling information to Documenting and compiling information to
ensure correctnessensure correctness
Tables Created in OracleTables Created in Oracle
ALTER TABLE ACTOR DROP CONSTRAINT ACTOR_pk;ALTER TABLE ACTOR DROP CONSTRAINT ACTOR_pk;DROP TABLE ACTOR;DROP TABLE ACTOR;
CREATE TABLE ACTORCREATE TABLE ACTOR(( ACTOR_IDACTOR_ID NUMBER(4), NUMBER(4), ACTOR_FNAME ACTOR_FNAME VARCHAR2(30),VARCHAR2(30), ACTOR_LNAMEACTOR_LNAME VARCHAR2(30),VARCHAR2(30), ACTOR_GENDERACTOR_GENDER VARCHAR2(1),VARCHAR2(1), CONSTRAINT ACTOR_pk PRIMARY KEY (ACTOR_ID)CONSTRAINT ACTOR_pk PRIMARY KEY (ACTOR_ID)););
Java Server Page CreatedJava Server Page Created
Elements UsedElements Used- HTMLHTML- SQLSQL- JDBCJDBC- JavaJava
The HTMLThe HTML
<html><head><html><head><title>Manage actors</title><title>Manage actors</title></head></head></html></html>Or use JSP to generate your HTMLOr use JSP to generate your HTML<%<%Out.println(“<html><head>”);Out.println(“<html><head>”);Out.println(“<title>Manage actors</title>”);Out.println(“<title>Manage actors</title>”);Out.println(“<head>”);Out.println(“<head>”);Out.println(“</html>”);Out.println(“</html>”);%>%>
The SQLThe SQL
- The SQL statements are generated and - The SQL statements are generated and then executedthen executed
sql = dbconn.prepareStatementsql = dbconn.prepareStatement ("select max(actor_id) mmov from actor");("select max(actor_id) mmov from actor");
sql.executeQuery();sql.executeQuery();
The JDBCThe JDBC
//Load Oracle Driver//Load Oracle DriverClass.forName("oracle.jdbc.driver.OracleDriver"); Class.forName("oracle.jdbc.driver.OracleDriver"); //establish connection to database //establish connection to database con = DriverManager.getConnectioncon = DriverManager.getConnection ("jdbc:oracle:thin:@Host:Port:DB", “user", “pass");("jdbc:oracle:thin:@Host:Port:DB", “user", “pass");
//create sql statement //create sql statement sql = dbconn.prepareStatement("select max(actor_id) mmov from sql = dbconn.prepareStatement("select max(actor_id) mmov from
actor");actor");
//get results of query //get results of query results = sql.executeQuery();results = sql.executeQuery();
The JavaThe Java
- Used various functionsUsed various functions
-- out.println(“<html>”);out.println(“<html>”);
-- Integer.parseInt(variable_name);Integer.parseInt(variable_name);
-- variablename.equals(“var2”);variablename.equals(“var2”);
- This area was not fully explored- This area was not fully explored
General Flow of the JSPsGeneral Flow of the JSPs
1) Import Java Libraries1) Import Java Libraries
2) Generate <HTML><HEAD>2) Generate <HTML><HEAD>
3) Get values from the calling HTML Form 3) Get values from the calling HTML Form or no values if default or initial page load.or no values if default or initial page load.
4) Connect to DB and Execute SQL4) Connect to DB and Execute SQL
5) Display Results and Generate Form5) Display Results and Generate Form
6) Generate Buttons on HTML form for 6) Generate Buttons on HTML form for Actions and generate ending HTML tags.Actions and generate ending HTML tags.
Deploying the JSPDeploying the JSP(For Apps on Local Hosts only)(For Apps on Local Hosts only)
- copy your .jsp file to: - copy your .jsp file to: $tomcat_home_dir\webapps\root $tomcat_home_dir\webapps\root
directory.directory.- Launch your Web Browser and type:- Launch your Web Browser and type:- - http://localhost:port/myapp.jsphttp://localhost:port/myapp.jsp- For more info: - For more info: http://jakarta.apache.org/tomcat/http://jakarta.apache.org/tomcat/
Difficulties EncounteredDifficulties Encountered
- The variables used in the SQL - The variables used in the SQL statements have to be checked and statements have to be checked and initialized if they are not set to a value.initialized if they are not set to a value.
- Configuring Apache Tomcat with the - Configuring Apache Tomcat with the correct Class Path (Oracle Drivers).correct Class Path (Oracle Drivers).
What took the longest?What took the longest?
Developing the Application took the Developing the Application took the longest, but experimenting and choosing longest, but experimenting and choosing the technology to use and configuring the the technology to use and configuring the technologies chosen consumed a great technologies chosen consumed a great deal of time as well.deal of time as well.
What would we do differently?What would we do differently?
We would have chosen Oracle, JSP, and We would have chosen Oracle, JSP, and Apache Tomcat immediately and created Apache Tomcat immediately and created a more advanced application using Java’s a more advanced application using Java’s full potential.full potential.
Improvements?Improvements?
The application needs more error The application needs more error checking. This was limited due to time checking. This was limited due to time constraints.constraints.
The appearance needs to be improved.The appearance needs to be improved.More data needs to be collected.More data needs to be collected.Reports would be nice.Reports would be nice.