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
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
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
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 …
May 02
Excel.jsp Page that demonstrates the use of JSP to build Excel spreadsheets #Programming Code Examples #Java/J2EE/J2ME #JSP
Excel.jsp Page that demonstrates the use of JSP to build Excel spreadsheets First Last Email Address Marty Hall hall@corewebprogramming.com Larry Brown brown@corewebprogramming.com Bill Gates gates@sun.com Larry Ellison ellison@microsoft.com <%@ page contentType="application/vnd.ms-excel" %> <%– There are tabs, not spaces, between columns. –%> Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10259 Categories:Programming …
May 02
PluginApplet.jsp Page that demonstrates the use of jsp:plugin. #Programming Code Examples #Java/J2EE/J2ME #JSP
PluginApplet.jsp Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF/classes directory where classes the server uses go. …
