AJPChapter3PPT JDBC
AJPChapter3PPT JDBC
Programming in Java
java.net
TCP/IP
Network OS
Copyright © 1997 Alex Chaffee
Vocabulary
Glossary of terms
Define the terms as used in this subject
Network independence
Works across Internet Protocol
Database independence
Java can access any database vendor
Ease of administration
Copyright © 1997 Alex Chaffee
zero-install client
Database Architectures
Two-tier
Three-tier
N-tier
Object-relational DB (ORDBMS)
add inheritance, blobs to RDB
NOT object-oriented -- “object” is mostly a marketing term
Object-oriented DB (OODB)
data stored as objects
high-performance for OO data models
Copyright © 1997 Alex Chaffee
Relational Databases
invented by Dr. E.F.Codd
data stored in records which live in tables
maps row (record) to column (field) in a
single table
“relation” (as in “relational”) means row to
column (not table to table)
Addresses
id
street
state
zip Copyright © 1997 Alex Chaffee
SQL
Structured Query Language
Standardized syntax for “querying”
(accessing) a relational database
Supposedly database-independent
Actually, there are important variations
from DB to DB
X/OPEN
ODBC JDBC
Type II
JDBC CLI (.lib)
“Native”
Type IV
“Pure”
Copyright © 1997 Alex Chaffee
Type I Drivers
Use bridging technology
Requires installation/configuration on client
machines
Not good for Web
e.g. ODBC Bridge
Driver
Connection
Statement
ResultSet
void close()
disposes of the ResultSet
allows you to re-use the Statement that created
it
automatically called by most Statement
methods Copyright © 1997 Alex Chaffee
ResultSet Methods
Type getType(int columnIndex)
returns the given field as the given type
fields indexed starting at 1 (not 0)
Stored Procedures
written in DB-specific language
stored inside database
accesed with Connection.prepareCall()
Copyright © 1997 Alex Chaffee
JDBC Class Diagram
Whoa!
Copyright © 1997 Alex Chaffee
Metadata
Connection:
DatabaseMetaData getMetaData()
ResultSet:
ResultSetMetaData getMetaData()