22.4. Applying the Database Utilities

Now, let's see how the database utilities of Section 22.3 can simplify the retrieval and display of database results. Listing 22.8 presents a class that connects to the database specified on the command line and prints out all entries in the employees table. Listings 22.9 and 22.10 show the results when connecting to Oracle and Sybase databases, respectively. Listing 22.11 shows a similar class that performs the same database lookup but formats the results in an HTML table. Listing 22.12 shows the raw HTML result.

Listing 22.13 shows the JDBC code used to create the employees table.

Listing 22.8. EmployeeTest.java
 package cwp; import java.sql.*; /** Connect to Oracle or Sybase and print "employees" table. ...

Get Core Web Programming, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.