Order the Book

coreservlets
Class FruitTest

java.lang.Object
  |
  +--coreservlets.FruitTest

public class FruitTest
extends Object

A JDBC example that connects to either an Oracle or a Sybase database and prints out the values of predetermined columns in the "fruits" table.

Taken from Core Servlets and JavaServer Pages from Prentice Hall and Sun Microsystems Press, http://www.coreservlets.com/. © 2000 Marty Hall; may be freely used or adapted.


Constructor Summary
FruitTest()
           
 
Method Summary
static void main(String[] args)
          Reads the hostname, database name, username, password, and vendor identifier from the command line.
static void showFruitTable(String driver, String url, String username, String password)
          Get the table and print all the values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FruitTest

public FruitTest()
Method Detail

main

public static void main(String[] args)
Reads the hostname, database name, username, password, and vendor identifier from the command line. It uses the vendor identifier to determine which driver to load and how to format the URL. The driver, URL, username, host, and password are then passed to the showFruitTable method.

showFruitTable

public static void showFruitTable(String driver,
                                  String url,
                                  String username,
                                  String password)
Get the table and print all the values.

Order the Book

Order
CSAJSP @ amazon.com

Return to Top-Level Source Code Archive