Please send questions to st10@humboldt.edu .
//
// modified from [CIS 318] Lab6.java, written by Ann Burroughs
//
// trying to demonstrate several of the getXXX() methods of
// class ResultSet
//
// NOTE: this WILL NOT WORK unless you add 
//       /home/univ/oracle/products/jdbc/lib/classes12.zip
// ...to your CLASSPATH!!!
//
// modified by: Sharon Tuttle
// last modified: 11-9-00

import java.sql.*;

public class DemoGetXXX
{

	public static void main(String args[])
	{
		Statement	myStmt;
		ResultSet	myResultSet;
		String		myQuery, rowToPrint;
		int		rowCount;

		try
		{
			// load JDBC driver
			Class.forName("oracle.jdbc.driver.OracleDriver");

			// create a connection to Oracle student database
			// on redwood, using account java/java
			Connection con = DriverManager.getConnection
            			("jdbc:oracle:thin:@redwood:1521:student",
             			 "java", "java");

			// declare and create a statement object, using
			// a Connection method createStatement()
			myStmt = con.createStatement();

			// this String contains the text of
			// my SQL query
			myQuery = "select empno, ename, job,  " +
                                        " mgr, hiredate, sal, " +
    					" comm, deptno        " +
	 			  "from   emp ";

			// this executes my query using the statement
			// instance, returning the result as a 
			// resultset object
			myResultSet = myStmt.executeQuery(myQuery);
			
			rowCount = 0;
			while (myResultSet.next() != false)
			{
				rowCount++;

				// declaring here for illustrative 
				// purposes only --- these variables
				// can certainly be declared above!!
				int empno = myResultSet.getInt("empno");
				String ename = myResultSet.getString("ename");
				String job = myResultSet.getString("job");
				int mgr = myResultSet.getInt("mgr");
				Date hiredate = myResultSet.getDate("hiredate");
				double sal = myResultSet.getDouble("sal");
				double comm = myResultSet.getDouble("comm");
				int deptno = myResultSet.getInt("deptno");

				System.out.println("row: " + rowCount);
				System.out.println("---------------------");
				System.out.println("empno:     " + empno);
				System.out.println("ename:     " + ename);
				System.out.println("job:       " + job);
				System.out.println("mgr:       " + mgr);
				System.out.println("hiredate:  " + hiredate);
				System.out.println("sal:       " + sal);
				System.out.println("comm:      " + comm);
				System.out.println("deptno:    " + deptno);
				System.out.println("---------------------");
			} // end of while loop reading table rows

			// CLOSE BOTH statement AND connection instances!!!
			// IMPORTANT!!!
			myStmt.close();
			con.close();
		}
		catch (Exception e)
		{
			System.out.println(e);
		}
	}
}