Oracle Programming - PowerPoint PPT Presentation

About This Presentation
Title:

Oracle Programming

Description:

architecture JDBC (Java Database Connectivity ) JDBC enables programmers to use SQL queries from within java programs to access databases. – PowerPoint PPT presentation

Number of Views:132
Avg rating:3.0/5.0
Slides: 15
Provided by: RaghuRa95
Category:

less

Transcript and Presenter's Notes

Title: Oracle Programming


1
Oracle Programming
2
architecture
 

3
JDBC (Java Database Connectivity )
  • JDBC enables programmers to use SQL queries from
    within java programs to access databases.
  • JDBC provides transparent access to relational
    databases from different vendors.

4
JDBC
5
JDBC steps
  • Create the database in your dbms
  • Register the database as a data source
  • Import java.sql. at the beginning of your java
    file.
  • Connect to a JDBC source
  • Connection con DriverManager.getConnection(jdbc
    oraclethin_at_cci-ora02.uncc.edu1521class,user
    ,passwd)
  • Create an SQL statement
  • Statement stmt con.createStatement()
  • stmt.executeUpdate("INSERT INTO sailor
    VALUES(22,'dustin',7,45.0)")

6
JDBC Step
  • Execute the statement
  • ResultSet rs stmt.executeQuery(Select from
    )
  • Parse the result
  • rs.next(), rs.getFloat
  • ResultSetMetaData contains the information about
    column
  • Close the statement and connection
  • stmt.close()
  • con.close

7
Useful resources
  • JDBC tutorial http//java.sun.com/docs/books/tutor
    ial/jdbc/index.html
  • UNCC COIT
  • https//cci-wiki01.uncc.edu/servlets
  • SampleJDBC.java on the class webpage

8
Java Servlets
  • Web servers understand requests for pages in http
    and return their response in HTML format
  • Static html vs. dynamic html
  • The webpage is based on data submitted by the
    user
  • The data changes frequently (a weather-report)
  • Web pages uses information from a database(stock)
  • Maintain separate data about each client for
    personalization purposes(cookies).
  • Java servlets are programs that extend the
    functionality of a web server and useful for
    building dynamic web pages on the fly.

9
Java Servlet Advantage
  • Works as a lightweight thread directly with the
    JVM rather than create a new process
  • Load once to memory and used by all threads
  • Share data among each other

10
How to run servlets
  • Your machine, Java servlet development kit(JSDK)
  • COIT
  • consult the webpage
  • https//cci-wiki01.uncc.edu/servlets

11
Examples
  • HelloWorld
  • http//coit-servlet02.uncc.edu8080/wwang22/HelloW
    orld
  • HelloWorld.java on the class webpage
  • More examples
  • DBServlet
  • http//coit-servlet02.uncc.edu8080/wwang22/DBServ
    let.html
  • DBServlet.java on the class webpage

12
JDBC and Servlet
  • Summary
  • 1. Download PUTTY and WinSCP
  • 2. Download HelloWorld, SampleJDBC and DBServlet
    source code
  • 3. Modify them and upload to your own space
  • 4. Compile and run it

13
Some links
  • https//cci-wiki01.uncc.edu/servlets
  • JDBC-Servlet.doc on the class webpage

14
Summary
  • 3-tire architecture
  • APIs such as JDBC and ODBC introduce a layer of
    abstraction between application and DBMS
  • Choose your language from JSP, Servlet, ASP,
    VC, VB.
Write a Comment
User Comments (0)
About PowerShow.com