Java JDBC API - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Java JDBC API

Description:

Can run on any platform with a Java Virtual Machine. Examples ... It is partly written in C and so loses Java's portability, security. JDBC is simpler than ODBC ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 13
Provided by: paulde8
Category:
Tags: api | jdbc | java | javas

less

Transcript and Presenter's Notes

Title: Java JDBC API


1
Java JDBC API
2
A Java API
  • To Access almost any kind of tabular data
  • Trademarked (not an acronym)
  • A set of classes and interfaces written in Java
  • Supports all dialects of SQL
  • Goes beyond SQL makes it possible to interact
    with other kinds of data sources such as files
    containing tabular data

3
Features
  • Can access almost any data source
  • Can run on any platform with a Java Virtual
    Machine

4
Examples
  • Possible to publish a web page containing an
    applet that uses information obtained from a
    remote data source
  • A company can connect all employees (using a
    collection of Windows, Mac, UNIX machines) to
    internal databases through an intranet
  • One can write a single program to send SQL
    statements to, e.g., an Oracle DB, a Sybase DB,
    and IBM DB2 DB.

5
What Does the Java API Do?
  • Establish a connection with a data source
  • Send queries and update statements to the data
    source
  • Process the results

6
Code Snippet
  • Connection con DriverManager.getConnection(
  • jdbcoraclethin_at_c
    s.gonzaga.edu1521basicdb,
  • myLogin,
    myPasswd)
  • Statement stmt con.createStatement()
  • ResultSet rs stmt.executeQuery(select lname
    from employee)
  • while (rs.next())
  • System.out.println(rs.getString(1))
  • stmt.close()

7
JDBC is similar to ODBC
  • An API for accessing data stores
  • But
  • It is partly written in C and so loses Javas
    portability, security
  • JDBC is simpler than ODBC
  • JDBC is written in Java for Java applications

8
JDBC Application (2-Tier Model)
Java Application
JDBC
DBMS
9
JDBC Applet (3-Tier Model)
Browser (Java Applet)
Java Program
JDBC
DBMS
10
Java Strengths
  • Java is portable
  • Java is object-oriented
  • Large library of classes and interfaces
  • Examples
  • Applets
  • Graphics
  • Sql
  • Security

11
Continued
  • Java makes it easier to write correct code
  • Automatic garbage collection
  • No pointers
  • Strong typing
  • Exception handling
  • Simplicity (no templates or multiple inheritance)

12
Continued
  • Security Features
  • Memory layout is determined at run-time (unlike
    c/c where compiler makes layout decisions)
  • Therefore, a programmer cant look at a class
    def. and figure out how it might be laid out
  • JVM checks incoming code for forged pointers,
    access restrictions
  • Classes from across the network cant be
    substituted for built-in classes
  • Built-in classes cant accidentally reference
    classes from across the network.
Write a Comment
User Comments (0)
About PowerShow.com