Java Reference
In-Depth Information
For more features of SQL, see Supplements IV.H and IV.I.
32.7
Create the tables Course , Student , and Enrollment using the create table
statements in Section  32.3.3, Creating and Dropping Tables. Insert rows into the
Course , Student , and Enrollment tables using the data in Figures 32.3-32.5.
Check
Point
32.8
List all CSCI courses with at least four credit hours.
32.9
List all students whose last names contain the letter e two times.
32.10
List all students whose birthdays are null.
32.11
List all students who take Math courses.
32.12
List the number of courses in each subject.
32.13
Assume that each credit hour is 50 minutes of lectures. Get the total minutes for the
courses that each student takes.
32.4 JDBC
JDBC is the Java API for accessing relational database.
Key
Point
The Java API for developing Java database applications is called JDBC . JDBC is the trade-
marked name of a Java API that supports Java programs that access relational databases.
JDBC is not an acronym, but it is often thought to stand for Java Database Connectivity.
JDBC provides Java programmers with a uniform interface for accessing and manipulating
relational databases. Using the JDBC API, applications written in the Java programming lan-
guage can execute SQL statements, retrieve results, present data in a user-friendly interface,
and propagate changes back to the database. The JDBC API can also be used to interact with
multiple data sources in a distributed, heterogeneous environment.
The relationships between Java programs, JDBC API, JDBC drivers, and relational data-
bases are shown in Figure 32.20. The JDBC API is a set of Java interfaces and classes used to
write Java programs for accessing and manipulating relational databases. Since a JDBC driver
serves as the interface to facilitate communications between JDBC and a proprietary data-
base, JDBC drivers are database specific and are normally provided by the database vendors.
You need MySQL JDBC drivers to access the MySQL database, and Oracle JDBC drivers
Java Programs
JDBC API
JDBC-ODBC
Bridge Driver
MySQL JDBC
Driver
Oracle JDBC
Driver
Microsoft ODBC
Driver
Local or remote
MySQL DB
Local or remote
ORACLE DB
Microsoft Access
Database
F IGURE 32.20
Java programs access and manipulate databases through JDBC drivers.
 
 
 
Search WWH ::




Custom Search