Java Reference
In-Depth Information
Figure 6.3. The JDBCAdapter class adapts information in a database table to appear in
Swing JTable component.
The JDBCAdapter class constructor establishes a database connection and creates
a Statement object. The adapter passes queries to the Statement object and makes
the results available in a GUI component.
The JDBCAdapter class assumes that a client will call executeQuery() before making
calls to extract data from the query. The results of not providing a query are somewhat
unpredictable. Noticing this, suppose that you decide to subclass JDBCAdapter with
an OzJDBCAdapter class that throws a NoQuery exception if a client forgets to issue a
query before asking for data.
Search WWH ::




Custom Search