# 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 …
Category: Java/J2EE/J2ME
Aug 04
DatabaseUtilities.java: Several general-purpose utilities discussed and used in the chapter.
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 …
Aug 04
EmployeeTest.java: A test case for the database utilities. Prints results in plain text.
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) …
Aug 03
Example Java Programs
HelloWorld.java public class HelloWorld { // method main(): ALWAYS the APPLICATION entry point public static void main (String[] args) { System.out.println (“Hello World!”); } } // Print Today’s Date import java.util.*; public class HelloDate { public static void main (String[] args) { System.out.println (“Hello, it’s: “); System.out.println(new Date()); …
Aug 03
FruitCreation.java: Creates a simple table named fruits in either an Oracle or a Sybase database.
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) { …
Aug 02
Example illustrating inheritance and abstract classes
illustrating inheritance এবং abstract classes এর উদাহরণ Shape.java সব, বদ্ধ খোলা, বাঁকা, এবং সোজা পার্শ্বে ধারবিশিষ্ট আকার এর জন্য প্যারেন্ট ক্লাস (সারাংশ)। Curve.java একটি (সারাংশ) বাঁকা আকার (খোলা বা বন্ধ)। StraightEdgedShape.java সরাসরি ধার সম্বলিত একটি আকৃতি (খোলা বা বন্ধ)। Measurable.java পরিমাপযোগ্য এলাকায় ইন্টারফেস ডিফাইনিং ক্লাস। Circle.java একটি বৃত্ত যা আকার প্রসারিত করে এবং পরিমাপ প্রয়োগ …
Aug 02
Some simple utilities for building Oracle and Sybase JDBC connections
এই সাধারণ উদ্দেশ্যে তৈরিকৃত কোড নয় – এটা আমাদের লোকাল সেটআপ এর ক্ষেত্রে প্রযোজ্য। 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 DriverUtilities { public static final int ORACLE = …
Aug 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.
# 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 …
Aug 01
ContactSection.jsp A snippet of a JSP page. It defines a field (accessCount), so pages that include it and want to directly utilize that field must use the include directive, not jsp:include.
ContactSection.jsp হচ্ছে JSP পৃষ্ঠার একটি অংশ।এটি একটি ফিল্ডকে সঙ্গায়িত করে (accessCount), সুতরাং যে পৃষ্ঠায় এটি অন্তর্ভুক্ত থাকে এবং সরাসরি উক্ত ফিল্ড ব্যবহার করাতে চায় তাকে আবশ্যই include directive ব্যবহার করতে হবে, jsp:include নয়।. <%@ page import=”java.util.Date” %> <%– The following become fields in each servlet that results from a JSP page that includes this file. –%> <%! …
Jul 31
J2SE : LinkedList and Iterators in Java
/* * LinkedList.java * * Created on January 10, 2008, 8:51 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package linkedlist; import java.util.List; import java.util.LinkedList; import java.util.Iterator; import java.util.ListIterator; import java.util.Collections; import java.util.Random; /** * * @author Sayed */ public class LinkedListTest …