/*
 * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/*
 * @(#)resultSetClient7.java	1.13 02/01/12
 */

package com.sun.cts.tests.jdbc.ee.resultSet.resultSet7;

import java.io.*;
import java.util.*;
import java.math.*;
import java.sql.*;
import javax.sql.*;

import com.sun.cts.util.*;
import com.sun.cts.porting.*;
import com.sun.cts.harness.*;

import java.rmi.RemoteException;

import javasoft.sqe.javatest.Status;
import com.sun.cts.tests.jdbc.ee.common.*;


// Merant DataSource class
//import com.merant.sequelink.jdbcx.datasource.*;

/**
 * The resultSetClient7 class tests methods of  resultSet interface using 
 * Sun's J2EE Reference Implementation.
 * @author  
 * @version 1.7, 9/9/99
 */

public class resultSetClient7 extends ServiceEETest implements Serializable
{
	private static final String testName = "jdbc.ee.resultSet.resultSet7";

	//Naming specific member variables
	private CTSNamingContextInterface jc = null;

	//Harness requirements 
	private transient Connection coffeeCon = null;
	private Statement stmt = null;
	private DataSource ds1 = null;
	private String drManager=null;
	private Properties props = null;
	private rsSchema rsSch=null;

	/* Run test in standalone mode */
	public static void main(String[] args) 
	{
		resultSetClient7 theTests = new resultSetClient7();
		Status s=theTests.run(args, System.out, System.err);
		s.exit();
	}

	/*  Test setup: */
	
	/*
	 *   @class.setup_props: Driver, the Driver name;
	 *			db1, the database name with url;
	 *			user1, the database user name;
	 *			password1, the database password;
	 *			db2, the database name with url;
	 *			user2, the database user name;
	 *			password2, the database password;
	 *			DriverManager, flag for DriverManager;
	 *			ptable, the primary table;
	 *			ftable, the foreign table;
	 *			cofSize, the initial size of the ptable;
	 *			cofTypeSize, the initial size of the ftable;
	 *			binarySize, size of binary data type;
	 *			varbinarySize, size of varbinary data type;
	 *			longvarbinarySize, size of longvarbinary data type;
	 *  @class.testArgs:     -ap ctssql.stmt
	 */
	public void setup(String[] args, Properties p) throws Fault 
	{
		try 
		{
			try
			{
				drManager = p.getProperty("DriverManager","");
				if (drManager.length() == 0)
					throw new Fault("Invalid DriverManager Name");

				props=p;
				if(drManager.equals("yes"))
				{
					logMsg("Using DriverManager");
					DriverManagerConnection dmCon = new DriverManagerConnection();
					coffeeCon = dmCon.getConnection(p);
					
				}
				else
				{
					logMsg("Using DataSource");
					DataSourceConnection dsCon = new DataSourceConnection();
					coffeeCon = dsCon.getConnection(p);
				}
				rsSch= new rsSchema();
				stmt = coffeeCon.createStatement();
			}
			catch(SQLException ex)
			{
				logErr("SQL Exception : " + ex.getMessage());
			}
		} 
		catch ( Exception e ) 
		{
			logErr("Setup Failed!");
			TestUtil.printStackTrace(e);
		}
	}
	


	/*
	 * @testName:         testGetObject61
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(int columnIndex) returns the value of column 
	 *                    columnIndex as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(int column index) 
	 *                    method with the SQL null column of JDBC datatype SMALLINT.
	 *                    It should return null Integer object.
	 */                    
	public void testGetObject61() throws Fault
	{
		Integer retValue=null;
		ResultSet rs = null;
		String Null_Val_Query=null;
		try
		{
			rsSch.createTab("Smallint_Tab",props,coffeeCon);
			//to get the query string
			Null_Val_Query=props.getProperty("Smallint_Query_Null","");
			rs=stmt.executeQuery(Null_Val_Query);
			rs.next();
			// invoke on the getObject
			logMsg("Calling  getObject on ResultSet");
			
			retValue=(Integer)rs.getObject(1);
			logMsg("Returned value is:"+retValue);
			
			if(retValue ==null) 
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the Null Value ");
				throw new Fault("Call to getObject  Failed!");
			}
			
		}
		catch (SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage() );
			throw new Fault("Call to getObject  Failed!", sqle);
		}
		catch (Exception e)
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject is Failed!", e);
		}
		finally
		{
			try 
			{
				rs.close();
				rsSch.dropTab("Smallint_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}

	}


	/*
	 * @testName:         testGetObject62
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(String columnName) returns the value of column 
	 *                    columnName as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(String columnName) 
	 *                    method with the column of JDBC datatype SMALLINT.
	 *                    It should return an Integer object that has been set as the 
	 *                    maximum value of SMALLINT.
	 */
	public void testGetObject62() throws Fault
	{
		String retValue  =null;
		String extractVal=null;
		String smaxShortVal=null;
		String str =null;
		String Max_Val_Query=null;
		ResultSet rs = null;
		ResultSetMetaData rsmd = null;
		try
		{
			rsSch.createTab("Smallint_Tab",props,coffeeCon);
			//to get the query string
			Max_Val_Query=props.getProperty("Smallint_Query_Max","");
			rs=stmt.executeQuery(Max_Val_Query);
			rsmd =rs.getMetaData();
			rs.next();
			
			// invoke on the getObject
			logMsg("Calling  getObject on ResultSet");
			str = rsmd.getColumnName(1);
			retValue=(""+rs.getObject(str)).trim();
			
			logMsg("Calling extractVal to get the Maximum Value of Short");
			smaxShortVal=rsSch.extractVal("Smallint_Tab",1,props,coffeeCon);
			extractVal = new String(smaxShortVal);
			
			if(extractVal.equals(retValue)) 
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the Maximum Value ");
				throw new Fault("Call to getObject is Failed!");
			}
		}
		catch ( SQLException sqle )
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getObject is Failed!", sqle);
		}
		catch ( Exception e )
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject is Failed!", e);
		}
		finally
		{
			try
			{
				rs.close();
				rsSch.dropTab("Smallint_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetObject63
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(String columnName) returns the value of column 
	 *                    columnName as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(String columnName) 
	 *                    method with the SQL column of JDBC datatype SMALLINT.
	 *                    It should return an Integer object that has been set as the 
	 *                    minimum value of SMALLINT.
	 */
	public void testGetObject63() throws Fault
	{
		String retValue =null;
		String extractVal=null;
		ResultSet rs = null;
		ResultSetMetaData rsmd =null;
		String str =null;
		String sminShortVal=null;
		String Min_Val_Query=null;
		try
		{
			rsSch.createTab("Smallint_Tab",props,coffeeCon);
			//to get the query string
			Min_Val_Query=props.getProperty("Smallint_Query_Min","");
			rs=stmt.executeQuery(Min_Val_Query);
			rsmd = rs.getMetaData();
			rs.next();
			
			// invoke on the getObject
			logMsg("Calling  getObject on ResultSet");
			str = rsmd.getColumnName(1);
			retValue=(""+rs.getObject(str)).trim();
			logMsg("Returned value is:"+retValue);	
			
			logMsg("Calling extractVal to get the Minimum Value of Short");
			sminShortVal=rsSch.extractVal("Smallint_Tab",2,props,coffeeCon);
			extractVal = new String(sminShortVal);
			
			if(retValue.equals(extractVal)) 
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the Minimum Value ");
				throw new Fault("Call to getObject is Failed!");
			}
		}
		catch ( SQLException sqle )
		{
			logErr("SQL Exception " + sqle.getMessage() );
			throw new Fault("Call to getObject is Failed!", sqle);
		}
		catch ( Exception e )
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject is Failed!", e);
		}
		finally
		{
			try
			{
				rs.close();
				rsSch.dropTab("Smallint_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetObject64
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(String columnName) returns the value of column 
	 *                    columnName as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(String columnName) 
	 *                    method with the SQL null column of JDBC datatype SMALLINT.
	 *                    It should return null Integer object.
	 */ 
	public void testGetObject64() throws Fault
	{
		Integer retValue =null;
		ResultSet rs = null;
		ResultSetMetaData rsmd =null;
		String str =null;
		String Null_Val_Query=null;
		try
		{
			rsSch.createTab("Smallint_Tab",props,coffeeCon);
			//to get the query string
			Null_Val_Query=props.getProperty("Smallint_Query_Null","");
			rs=stmt.executeQuery(Null_Val_Query);
			rsmd=rs.getMetaData();
			rs.next();
			// invoke on the getObject
			logMsg("Calling  getObject on ResultSet");
			str=rsmd.getColumnName(1);
			retValue=(Integer)rs.getObject(str);
			logMsg("Returned value is:"+retValue);	
			if(retValue ==null) 
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the Null Value ");
				throw new Fault("Call to getObject  Failed!");
			}
			
		}
		catch (SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage() );
			throw new Fault("Call to getObject  Failed!", sqle);
		}
		catch (Exception e)
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject is Failed!", e);
		}
		finally
		{
			try
			{
				rs.close();
				rsSch.dropTab("Smallint_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetObject65
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(int columnIndex) returns the value of column 
	 *                    columnIndex as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(int columnIndex) 
	 *                    method with the SQL column of JDBC datatype VARCHAR.
	 *                    It should return an String object that has been set.
	 */  
	public void testGetObject65() throws Fault
	{
		String retValue = null ;
		String Str_Query = null;
		ResultSet rs = null;
		String str =null;
		String strVal=null;
		try
		{
			rsSch.createTab("Varchar_Tab",props,coffeeCon);
			//to get the query string
			Str_Query=props.getProperty("Varchar_Query_Name","");
			rs=stmt.executeQuery(Str_Query);
			rs.next();
			
			// invoke on the Float
			logMsg("Calling  getObject on ResultSet");
			retValue=(String)rs.getObject(1);
			logMsg("returned Value:"+retValue);	
			logMsg("Calling extractVal to get the  Value of VarChar");
			strVal=rsSch.extractVal("Varchar_Tab",1,props,coffeeCon);
			logMsg("extracted value:"+strVal);	
			strVal=strVal.substring(1,strVal.length()-1);	
			if (strVal.equals(retValue.trim())) 
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the VarChar Value ");
				throw new Fault("Call to getObject  Failed!");
			}
			
		}
		catch ( SQLException sqle )
		{
			logErr("SQL Exception " + sqle.getMessage() );
			throw new Fault("Call to getObject  Failed!", sqle);
		}
		catch ( Exception e )
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject  Failed!", e);
		}
		finally
		{
			try
			{
				rs.close();
				rsSch.dropTab("Varchar_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetObject66
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(int columnIndex) returns the value of column 
	 *                    columnIndex as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(int column index) 
	 *                    method with the SQL null column of JDBC datatype VARCHAR.
	 *                    It should return null String object. 
	 */ 
	public void testGetObject66() throws Fault
	{
		String retValue = null;
		ResultSet rs = null;
		String Str_Null_Query=null;
		try
		{
			rsSch.createTab("Varchar_Tab",props,coffeeCon);
			//to get the query string
			Str_Null_Query=props.getProperty("Varchar_Query_Null","");
			rs=stmt.executeQuery(Str_Null_Query);
			rs.next();
			// invoke on the getObject
			logMsg("Calling  getObject on ResultSet");
			retValue=(String)rs.getObject(1);
			logMsg("THE Returned Value is :"+retValue);	
			
			if(retValue == null)
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the Null Value ");
				throw new Fault("Call to getObject  Failed!");
			}
		
		}
		catch ( SQLException sqle )
		{
			logErr("SQL Exception " + sqle.getMessage() );
			throw new Fault("Call to getObject Failed!", sqle);
		}
		catch ( Exception e )
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject Failed!", e);
		}
		finally
		{
			try
			{
				rs.close();
				rsSch.dropTab("Varchar_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}
	}


	/* @testName:         testGetObject67
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(String columnName) returns the value of column 
	 *                    columnName as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(String columnName) 
	 *                    method with the SQL column of JDBC datatype VARCHAR.
	 *                    It should return an String object that has been set.
	 */ 
	public void testGetObject67() throws Fault
	{
		String retValue = null ;
		String Str_Query = null;
		ResultSet rs = null;
		ResultSetMetaData rsmd =null;
		String str =null;
		String strVal=null;
		try
		{
			rsSch.createTab("Varchar_Tab",props,coffeeCon);
			//to get the query string
			Str_Query=props.getProperty("Varchar_Query_Name","");
			rs=stmt.executeQuery(Str_Query);
			rsmd =rs.getMetaData();
			rs.next();
			
			// invoke on the Float
			logMsg("Calling  getObject on ResultSet");
			str =rsmd.getColumnName(1);
			retValue=(String)rs.getObject(str);
			logMsg("returned Value:"+retValue);	
			logMsg("Calling extractVal to get the  Value of VarChar");
			strVal=rsSch.extractVal("Varchar_Tab",1,props,coffeeCon);
			logMsg("extracted value:"+strVal);	
			strVal=strVal.substring(1,strVal.length()-1);	
			if (strVal.equals(retValue.trim())) 
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the VarChar Value ");
				throw new Fault("Call to getObject  Failed!");
			}
			
		}
		catch ( SQLException sqle )
		{
			logErr("SQL Exception " + sqle.getMessage() );
			throw new Fault("Call to getObject  Failed!", sqle);
		}
		catch ( Exception e )
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject  Failed!", e);
		}
		finally
		{
			try
			{
				rs.close();
				rsSch.dropTab("Varchar_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetObject68
	 *                    
	 * @assertion:        The ResultSet object contains the results of executing an 
	 *                    SQL Query.  ResultSets may hava different levels of functionality 
	 *                    (ResultSet Types TYPE_FORWARD_ONLY, TYPE_SCROLL_SENSITIVE, 
	 *                    TYPE_SCROLL_INSENSITIVE) and update capabilities (ResultSet 
	 *                    Concurrency). (See section 26.1 of JDBC 2.0 API Reference 
	 *                    & Tutorial second edition).  The JDBC driver must provide full 
	 *                    support for TYPE_SCROLL_INSENSITIVE result sets. (See section 
	 *                    6.2.2.3 of Java2 Platform Enterprise Edition Specification v1.2)
	 *                    The getObject(String columnName) returns the value of column 
	 *                    columnName as an Object in the java programming language and
	 *                    if there is custom mapping, the data type of the object will be
	 *                    default Java object corresponding to column's JDBC type; and 
	 *                    null if the value is SQL null. 
	 *                    
	 * @test_Strategy:    Get a ResultSet object from the Connection to
	 *                    the database. Call the getObject(String columnName) 
	 *                    method with the SQL null column of JDBC datatype VARCHAR.
	 *                    It should return null String object.
	 */
	public void testGetObject68() throws Fault
	{
		String retValue = null;
		ResultSet rs = null;
		String str =null;
		ResultSetMetaData rsmd =null;
		String Str_Null_Query=null;
		try
		{
			rsSch.createTab("Varchar_Tab",props,coffeeCon);
			//to get the query string
			Str_Null_Query=props.getProperty("Varchar_Query_Null","");
			rs=stmt.executeQuery(Str_Null_Query);
			rsmd =rs.getMetaData();
			rs.next();
			// invoke on the getObject
			logMsg("Calling  getObject on ResultSet");
			str =rsmd.getColumnName(1);
			retValue=(String)rs.getObject(str);
			logMsg("The Returned Value is :"+retValue);	
			
			if(retValue == null)
			{
				logMsg("getObject method returns : "+ retValue);
			}
			else
			{
				logErr("getObject method does not return the Null Value ");
				throw new Fault("Call to getObject  Failed!");
			}
			
		
		}
		catch ( SQLException sqle )
		{
			logErr("SQL Exception " + sqle.getMessage() );
			throw new Fault("Call to getObject Failed!", sqle);
		}
		catch ( Exception e )
		{
			logErr("Unexpected exception " + e.getMessage() );
			throw new Fault("Call to getObject Failed!", e);
		}
		finally
		{
			try
			{
				rs.close();
				rsSch.dropTab("Varchar_Tab",coffeeCon);
			}
			catch (Exception e) {};
		}
	}


	/* cleanup */
	public void  cleanup() throws Fault	
	{
		try
		{
			stmt.close();
			// Close the database 
			rsSch.dbUnConnect(coffeeCon);
			logMsg("Cleanup ok;");
		}
		catch (Exception e)
		{
			logErr("An error occurred while closing the database connection");
		}
	}
}
