When you use the two-tier database access model, your Java application talks directly to the
database. This is accomplished through the use of a JDBC driver, which sends commands
directly to the database. The results of these commands are then sent back from the database
directly to the application. Figure 7.1 shows the two-tier model.
F IGURE 7.1
The two-tier JDBC model.
The three-tier model, as you might have guessed, is a little more complicated. When you use
the three-tier model, your JDBC driver sends commands to a middle tier, which in turn sends
commands to the database. The results of these commands are then sent back to the middle
tier, which communicates them back to the application. Figure 7.2 shows the three-tier model.
JDBC Driver Types
Sun has defined four JDBC driver types:
JDBC-ODBC Bridge, plus ODBC driver
Native-API, partly Java driver
JDBC-net, pure Java driver
Native-protocol, pure Java driver
Each of these types meets a different application need, as we'll discuss in the following sec-