Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
482
Chapter 18 JDBC and Database Connection Pooling
Listing 18.7  DBResults.java (continued)
    }
    for(int row=0; row
      buffer.append("\n  \n    ");
      String[] rowData = getRow(row);
      for(int col=0; col
        buffer.append("" + rowData[col]);
      }
    }
    buffer.append("\n");
    return(buffer.toString());
  } 
}
18.4 Applying the Database 
Utilities
Now, let's see how the database utilities of Section 18.3 can simplify the
retrieval and display of database results. Listing 18.8 presents a class that con 
nects to the database specified on the command line and prints out all entries
in the 
employees
 table. Listings 18.9 and 18.10 show the results when con 
necting to Oracle and Sybase databases, respectively. Listing 18.11 shows a
similar class that performs the same database lookup but formats the results
in an HTML table. Listing 18.12 shows the raw HTML result. I'll put an
HTML table like this in a real Web page in Section 18.8 (Connection Pool 
ing: A Case Study).
Listing 18.13 shows the JDBC code used to create the 
employees
 table.
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved