JSP, Java Beans, JDBC - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

JSP, Java Beans, JDBC

Description:

Things to do.. Install tomcat with proper settings ... Set CLASSPATH to use Oracle's JDBC on CISE Solaris machines. Login to Oracle and create simple database ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 12
Provided by: cise8
Category:
Tags: jdbc | jsp | beans | java

less

Transcript and Presenter's Notes

Title: JSP, Java Beans, JDBC


1
JSP, Java Beans, JDBC
2
Things to do..
  • Install tomcat with proper settings
  • Place sample html, jsp, javabean files in proper
    directories
  • Set CLASSPATH to use Oracle's JDBC on CISE
    Solaris machines
  • Login to Oracle and create simple database tables
  • Run tomcat and the JSP file

3
JSP
  • Set up the tomcat environment in your home
    directory.
  • gt mkdir /tomcat
  • gt cd /tomcat
  • gt tar xf /usr/local/java/tomcat/cise/cise.tar
  • Go to conf directory and open Server.xml
  • gt cd conf
  • gt emacs server.xml

4
JSP (Cont.)
  • Look for the two lines containing
  • port"8005" (line 13)
  • port"8080" (line 92)
  • Change both to something between 10000 and 65000.
    (for our class I have assigned port numbers. If
    you were not in class, please use something
    between 44000 and 50000)
  • Make a note of the port number that you replace
    the 8080 with.
  • Save changes ctrl x s
  • ???while pressing ctrl, type x and type s
  • Quit emacs ctrl x c
  • ???while pressing ctrl, type x and type c
  • After this, you are ready to use the tomcat
    server!

5
Download Files (index_.html, login.jsp)
  • In a tomcat application HTML files and JSP files
    must go in the directory
  • /tomcat/webapps/jsp-examples/directoryYouCreate
  • Change directory
  • gt cd /tomcat/webapps/jsp-examples
  • Create directory to place html, jsp files
  • gt mkdir cen3031
  • Download index_.html, login.jsp into the
    directory you just created (e.g. cen3031) from
    www.cise.ufl.edu/vgummulu/cen3031 (There is a
    link to get the files)

6
Download Files (DataBean.java)
  • Java servlets and Java Beans must go in the
    directory
  • /tomcat/webapps/jsp-examples/WEB-INF/classes
  • Change directory
  • gt cd /tomcat/webapps/jsp-examples/WEB-INF/classe
    s
  • Create directory
  • (DataBean.java uses a package named queryDemo)
  • gt mkdir queryDemo
  • Download DataBean.java into the queryDemo
    directory

7
Set CLASSPATH for JDBC
  • To use Oracle's JDBC on CISE Solaris machines,
    add the following to your CLASSPATH
  • Go to your home directory gt cd
  • Open your setup file gt emacs .cshrc (or .tcshrc)
  • Add following line at the end of CLASSPATH
  • /usr/local/libexec/oracle-client/jdbc/lib/classe
    s12.zip
  • Save and close the setup file (ctrl x s, ctrl x c)

8
Set JDBC connection with your account
  • Open DataBean.java
  • gt emacs DataBean.java
  • Inside of doRetrieve() method, make change as
    following
  • Connection conn DriverManager.getConnection
    ("jdbcoraclethinhr/hr_at_oracle1.cise.ufl.edu1521
    orcl",
  • your cise id", oracle account password")
  • Save the file and quit (again ctrl x s, ctrl x c)
  • Compile the java source file
  • gt javac DataBean.java

9
JDBC Create Sample Tables
  • Download database.script to your home directory
  • Open another console
  • To use the command line "sqlplus" utility (Need
    to have Oracle account for this)
  • gt source /usr/local/etc/ora.csh
  • gt sqlplus ltusernamegt_at_orcl
  • ??? Enter your oracle account password.
  • To create DB tables type following
  • SQLgt_at_database.script
  • Quit
  • SQLgtexit

10
Run Tomcat
  • For some reason, tomcat is not running on Linux
    machines
  • Login to sand or rain using SSH
  • gt ssh rain.cise.ufl.edu
  • Go to the tomcat directory
  • gt cd /tomcat
  • Start up tomcat
  • gt tomcat-start

11
Open index_.html and run login.jsp
  • Open Web browser
  • Go to following page
  • http//rain.cise.ufl.eduportnumber/jsp-examples/c
    en3031/index_.html
  • Enter your names and see what is coming!
  • Shut down tomcat before you leave!!!!!!!!!!!!!!
    (from rain)
  • cd /tomcat
  • tomcat-shutdown
Write a Comment
User Comments (0)
About PowerShow.com