Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
514
Chapter 18 JDBC and Database Connection Pooling
Listing 18.23 ConnectionPoolServlet3.java (continued)
      DBResults results =
        DatabaseUtilities.getQueryResults(connection,
                                          query, true);
      table = results.toHTMLTable("#FFAD00");
    } catch(Exception e) {
      table = "Exception: " + e;
    }
    response.setContentType("text/html");
    // Prevent the browser from caching the response. See
    // Section 7.2 of Core Servlets and JSP for details.
    response.setHeader("Pragma", "no cache"); // HTTP 1.0
    response.setHeader("Cache Control", "no cache"); // HTTP 1.1
    PrintWriter out = response.getWriter();
    String title = "Connection Pool Test (*No* Pooling)";
    out.println(ServletUtilities.headWithTitle(title) +
                "\n" +
                "
\n" +
                table + "\n" +
                "\n");
  }
  
  public void init() {
    try {
      int vendor = DriverUtilities.SYBASE;
      String driver = DriverUtilities.getDriver(vendor);
      Class.forName(driver);
      String host = "dbhost2.apl.jhu.edu";
      String dbName = "605741";
      url = DriverUtilities.makeURL(host, dbName, vendor);
      username = "hall";
      password = "xxxx"; // Changed : )
    } catch(ClassNotFoundException e) {
      System.err.println("Error initializing: " + e);
      getServletContext().log("Error initializing: " + e);
    }
  }
}
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