Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
470
Chapter 18 JDBC and Database Connection Pooling
Listing 18.3  FruitTest.java (continued)
        // Quarter
        System.out.print("    " + resultSet.getInt(1));
        // Number of Apples
        System.out.print("     " + resultSet.getInt(2));
        // Apple Sales
        System.out.print("   $" + resultSet.getFloat(3));
        // Number of Oranges
        System.out.print("    " + resultSet.getInt(4));
        // Orange Sales
        System.out.print("    $" + resultSet.getFloat(5));
        // Top Salesman
        System.out.println("      " + resultSet.getString(6));
      }
    } catch(ClassNotFoundException cnfe) {
      System.err.println("Error loading driver: " + cnfe);
    } catch(SQLException sqle) {
      System.err.println("Error connecting: " + sqle);
    }
  }
  private static void printUsage() {
    System.out.println("Usage: FruitTest host dbName " +
                       "username password oracle|sybase.");
  }
}
Listing 18.4  DriverUtilities.java 
package coreservlets;
/** Some simple utilities for building Oracle and Sybase
 *  JDBC connections. This is not general purpose
 *  code    it is specific to my local setup.
*/
public class DriverUtilities {
  public static final int ORACLE = 1;
  public static final int SYBASE = 2;
  public static final int UNKNOWN =  1;
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