package cwp; import java.sql.*; /** Connect to Oracle or Sybase and print "employees" table. * */ public class EmployeeTest { public static void main(String[] args) { if (args.length < 5) { printUsage(); return; } String vendorName = args[4]; int vendor = DriverUtilities.getVendor(vendorName); if (vendor == DriverUtilities.UNKNOWN) { printUsage(); return; } String driver = DriverUtilities.getDriver(vendor); String …
Category: FromSitesTree.com
May 03
EmployeeTest2.java: A test case for the database utilities. Prints results formatted as an HTML table. #Programming Code Examples #Java/J2EE/J2ME #JDBC
package cwp; import java.sql.*; /** Connect to Oracle or Sybase and print "employees" table * as an HTML table. * */ public class EmployeeTest2 { public static void main(String[] args) { if (args.length < 5) { printUsage(); return; } String vendorName = args[4]; int vendor = DriverUtilities.getVendor(vendorName); if (vendor == DriverUtilities.UNKNOWN) { printUsage(); return; } …
May 02
FruitCreation.java: Creates a simple table named fruits in either an Oracle or a Sybase database. #Programming Code Examples #Java/J2EE/J2ME #JDBC
FruitCreation.java Creates a simple table named fruits in either an Oracle or a Sybase database. ************************************** package cwp; import java.sql.*; /** Creates a simple table named "fruits" in either * an Oracle or a Sybase database. * */ public class FruitCreation { public static void main(String[] args) { if (args.length < 5) { printUsage(); return; …
May 02
DatabaseUtilities.java: Several general-purpose utilities discussed and used in the chapter. #Programming Code Examples #Java/J2EE/J2ME #JDBC
package cwp; import java.sql.*; /** Three database utilities: * 1) getQueryResults. Connects to a database, executes * a query, retrieves all the rows as arrays * of strings, and puts them inside a DBResults * object. Also places the database product name, * database version, and the names of all the columns * into the …
May 02
DBResults.java: Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways #Programming Code Examples #Java/J2EE/J2ME #JDBC
# DBResults.java Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways: * ResultSet doesn?t necessarily have all the data; reconnection to database occurs as you ask for later rows. * This class stores results as strings, in arrays. * This class includes DatabaseMetaData (database product name and version) …
May 02
FruitTest.java: A class that connects to either an Oracle or a Sybase database and prints out the values of predetermined columns in the "fruits" table. #Programming Code Examples #Java/J2EE/J2ME #JDBC
# FruitTest.java A class that connects to either an Oracle or a Sybase database and prints out the values of predetermined columns in the "fruits" table. package cwp; import java.sql.*; /** A JDBC example that connects to either an Oracle or * a Sybase database and prints out the values of * predetermined columns in …
May 02
Some simple utilities for building Oracle and Sybase JDBC connections #Programming Code Examples #Java/J2EE/J2ME #JDBC
DriverUtilities.java Some simple utilities for building Oracle and Sybase JDBC connections. This is not general-purpose code — it is specific to our local setup. package cwp; /** 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 …
May 02
BGColor.jsp Page that demonstrates JSP scriptlets. Uses the JSP-Styles style sheet. #Programming Code Examples #Java/J2EE/J2ME #JSP
BGColor.jsp Page that demonstrates JSP scriptlets. Uses the JSP-Styles style sheet. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!– Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>Color Testing</TITLE> </HEAD> <% String bgColor = request.getParameter("bgColor"); boolean hasExplicitColor = …
May 02
AccessCounts.jsp Page that demonstrates JSP declarations. #Programming Code Examples #Java/J2EE/J2ME #JSP
AccessCounts.jsp Page that demonstrates JSP declarations. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!– Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>JSP Declarations</TITLE> <META NAME="keywords" CONTENT="JSP,declarations,JavaServer,Pages,servlets"> <META NAME="description" CONTENT="A quick example of JSP declarations."> <LINK REL=STYLESHEET HREF="JSP-Styles.css" …
May 02
ImportAttribute.jsp Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class #Programming Code Examples #Java/J2EE/J2ME #JSP
ImportAttribute.jsp Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class (Check Servlet Section) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!– Example of the import attribute of the page directive. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used …
