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

/*
 * @(#)callStmtClient1.java	1.9 02/01/12
 */

package com.sun.cts.tests.jdbc.ee.callStmt.callStmt1;

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 callStmtClient1 class tests methods of DatabaseMetaData interface using
 * Sun's J2EE Reference Implementation.
 * @author
 * @version 1.7, 06/16/99
 */
public class callStmtClient1 extends ServiceEETest implements Serializable
{
	private static final String testName = "jdbc.ee.callStmt.callStmt1";
	//Naming specific member variables
	private CTSNamingContextInterface jc = null;

	//Harness requirements
	private transient Connection conn = null;
	private DataSource ds1 = null;
	private rsSchema rsSch=null;
	private String drManager=null;
	private Properties sqlp = null;
	private CallableStatement cstmt = null;

	/* Run test in standalone mode */
	public static void main(String[] args)
	{
		callStmtClient1 theTests = new callStmtClient1();
		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");
				sqlp=p;

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


	/*
	 * @testName:         testGetBigDecimal01
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getBigDecimal(int parameterIndex) method gets the value of a
	 *                    JDBC Numeric parameter value as a java.math.BigDecimal object with
	 *                    full precision.  If the value is SQL NULL, the value returned will
	 *                    be null.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getBigDecimal(int parameterIndex) method to retrieve the
	 *                    maximum value of the Numeric_Tab. Extract the maximum value from the
	 *                    ctssql.stmt file.Compare this value with the value returned by the
	 *                    getBigDecimal(int parameterIndex) method.Both the values should be
	 *                    equal.
	 */
	public void testGetBigDecimal01() throws Fault
	{
		BigDecimal maxBigDecimalVal = null;
		BigDecimal oRetVal = null;
		try
		{
			rsSch.createTab("Numeric_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Numeric_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.NUMERIC,15);
			cstmt.registerOutParameter(2,java.sql.Types.NUMERIC,15);
			cstmt.registerOutParameter(3,java.sql.Types.NUMERIC,15);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getBigDecimal(MAX_VAL)");

			//invoke getBigDecimal method
			oRetVal = cstmt.getBigDecimal(1);
			String sRetStr = rsSch.extractVal("Numeric_Tab",1,sqlp,conn);
			maxBigDecimalVal = new BigDecimal(sRetStr);

			if( (oRetVal.compareTo(maxBigDecimalVal) == 0) )
			{
				logMsg("getBigDecimal returns the Maximum value " + oRetVal.toString());
			}
			else
			{
				logErr("getBigDecimal() did not return the Maximum value");
				throw new Fault("Call to getBigDecimal Failed!");
			}
			
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getBigDecimal is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getBigDecimal Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Numeric_Tab",conn);
				
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetBigDecimal02
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getBigDecimal(int parameterIndex) method gets the value of a
	 *                    JDBC Numeric parameter value as a java.math.BigDecimal object with
	 *                    full precision.  If the value is SQL NULL, the value returned will
	 *                    be null.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getBigDecimal(int parameterIndex) method to retrieve the
	 *                    minimum value of the Numeric_Tab. Extract the minimum value from
	 *                    the ctssql.stmt file.Compare this value with the value returned by the
	 *                    getBigDecimal(int parameterIndex).Both the values should be
	 *                    equal.
	 */
	public void testGetBigDecimal02() throws Fault
	{
		BigDecimal oRetVal = null;
		BigDecimal minBigDecimalVal = null;
		try
		{
			rsSch.createTab("Numeric_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Numeric_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.NUMERIC,15);
			cstmt.registerOutParameter(2,java.sql.Types.NUMERIC,15);
			cstmt.registerOutParameter(3,java.sql.Types.NUMERIC,15);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getBigDecimal(MIN_VAL)");

			//invoke getBigDecimal method
			oRetVal = cstmt.getBigDecimal(2);
			String sRetStr = rsSch.extractVal("Numeric_Tab",2,sqlp,conn);
			logMsg("Value fetched from ctssqlstmt :");
			minBigDecimalVal = new BigDecimal(sRetStr);
			logMsg("Value returned from Table :" +oRetVal);
			logMsg("Value returned from ctssql.stmt :" +minBigDecimalVal);
			
			if( (oRetVal.compareTo(minBigDecimalVal) == 0) )
				logMsg("getBigDecimal returns the Minimum value " + oRetVal.toString());
			else
			{
				logErr("getBigDecimal() did not return the Minimum value");
				throw new Fault("Call to getBigDecimal Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getBigDecimal is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getBigDecimal Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null) 
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Numeric_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetBigDecimal03
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getBigDecimal(int parameterIndex) method gets the value of a
	 *                    JDBC Numeric parameter value as a java.math.BigDecimal object with
	 *                    full precision.  If the value is SQL NULL, the value returned will
	 *                    be null.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getBigDecimal(int parameterIndex) method to retrieve the
	 *                    null value from Numeric_Tab. Check if it returns null
	 */
	public void testGetBigDecimal03() throws Fault
	{
		try
		{
			rsSch.createTab("Numeric_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Numeric_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.NUMERIC,15);
			cstmt.registerOutParameter(2,java.sql.Types.NUMERIC,15);
			cstmt.registerOutParameter(3,java.sql.Types.NUMERIC,15);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getBigDecimal(NULL_VAL)");

			//invoke getBigDecimal method
			BigDecimal oRetVal = cstmt.getBigDecimal(3);
			
			if(oRetVal == null)
				logMsg("getBigDecimal returns the Null value " + oRetVal);
			else
			{
				logErr("getBigDecimal() did not return the Null value");
				throw new Fault("Call to getBigDecimal Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getBigDecimal is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getBigDecimal Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Numeric_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetDouble01
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getDouble(int parameterIndex) gets the value of a JDBC FLOAT
	 *                    parameter as a float in the Java programming language.If the value
	 *                    is SQL NULL,the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getDouble(int parameterIndex) method to retrieve the maximum value.
	 *                    of the Float_Tab. Extract the maximum value from the ctssql.stmt
	 *                    file.Compare this value with the value returned by the
	 *                    getDouble(int parameterIndex). Both the values should be equal.
	 */
	public void testGetDouble01() throws Fault
	{
		Double oRetVal=null;
		Double maxDoubleVal = null;
		try
		{
			rsSch.createTab("Double_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Double_Proc(?,?,?)}");



			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.DOUBLE);
			cstmt.registerOutParameter(2,java.sql.Types.DOUBLE);
			cstmt.registerOutParameter(3,java.sql.Types.DOUBLE);
			
			
			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getFloat(MAX_VAL)");

			//invoke getFloat method
			double fRetVal =cstmt.getDouble(1);
			oRetVal = new Double(fRetVal);
			String sRetStr = rsSch.extractVal("Double_Tab",1,sqlp,conn);
			maxDoubleVal = new Double(sRetStr);
			logMsg("Value returned from table :" +oRetVal);
			logMsg("Value returned from ctssql.stmt  :" +maxDoubleVal);
			
			if(oRetVal.equals(maxDoubleVal))
			{
				logMsg("getDouble returns the Maximum value " + oRetVal.toString());
			}
			else
			{
				logErr("getDouble() did not return the Maximum value");
				throw new Fault("Call to getDouble Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getDouble is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getDouble Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				
				rsSch.dropTab("Float_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetDouble02
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getDouble(int parameterIndex) gets the value of a JDBC FLOAT
	 *                    parameter as a float in the Java programming language.If the value
	 *                    is SQL NULL,the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getDouble(int parameterIndex) method to retrieve the minimum value
	 *                    of the Float_Tab. Extract the minimum value from the ctssql.stmt file.
	 *                    Compare this value with the value returned by the
	 *                    getDouble(int parameterIndex). Both the values should be equal.
	 */
	public void testGetDouble02() throws Fault
	{
		Double oRetVal = null;
		Double minDoubleVal = null;
		try
		{
			rsSch.createTab("Double_Tab",sqlp,conn);
			logMsg("Max value of float :" + java.lang.Float.MAX_VALUE);						

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Double_Proc(?,?,?)}");
			logMsg("After creating...");
			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.DOUBLE);
			cstmt.registerOutParameter(2,java.sql.Types.DOUBLE);
			cstmt.registerOutParameter(3,java.sql.Types.DOUBLE);

			logMsg("After registering...");

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getDouble(MIN_VAL)");

			//invoke getFloat method
			double fRetVal =cstmt.getDouble(2);
			oRetVal = new Double(fRetVal);
			String sRetStr = rsSch.extractVal("Double_Tab",2,sqlp,conn);
			minDoubleVal = new Double(sRetStr);
			
			if(oRetVal.equals(minDoubleVal))
				logMsg("getDouble returns the Minimum value " + oRetVal.toString());
			else
			{
				logErr("getDouble() did not return the Minimum value");
				throw new Fault("Call to getDouble Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getDouble is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getDouble Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				
				rsSch.dropTab("Float_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetDouble03
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getDouble(int parameterIndex) gets the value of a JDBC FLOAT
	 *                    parameter as a float in the Java programming language.If the value
	 *                    is SQL NULL,the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getDouble(int parameterIndex) method to retrieve the null value
	 *                    from Float_Tab. Check if it returns null
	 */
	public void testGetDouble03() throws Fault
	{
		try
		{
			rsSch.createTab("Double_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Double_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.DOUBLE);
			cstmt.registerOutParameter(2,java.sql.Types.DOUBLE);
			cstmt.registerOutParameter(3,java.sql.Types.DOUBLE);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getDouble(NULL_VAL)");

			//invoke getFloat method
			double oRetVal =cstmt.getDouble(3);
			
			if(oRetVal == 0)
				logMsg("getDouble returns the Null value " + oRetVal);
			else
			{
				logErr("getDouble() did not return the Null value");
				throw new Fault("Call to getDouble Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getDouble is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getDouble Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Float_Tab",conn);
			}catch (Exception e) {};
		}
	}



	/*
	 * @testName:         testGetShort01
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getShort(int parameterIndex) method gets the value of a JDBC
	 *                    SMALLINT parameter as a short in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getShort(int parameterIndex) method to retrieve the maximum value
	 *                    of the Smallint_Tab. Extract the maximum value from the ctssql.stmt
	 *                    file.Compare this value with the value returned by the
	 *                    getShort(int parameterIndex). Both the values should be equal.
	 */
	public void testGetShort01() throws Fault
	{
		Short oRetVal = null;
		Short maxShortVal = null;
		try
		{
			rsSch.createTab("Smallint_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Smallint_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.SMALLINT,0);
			cstmt.registerOutParameter(2,java.sql.Types.SMALLINT,0);
			cstmt.registerOutParameter(3,java.sql.Types.SMALLINT,0);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getShort(MAX_VAL)");

			//invoke getShort method
			short rRetVal =cstmt.getShort(1);
			oRetVal = new Short(rRetVal);
			String sRetStr = rsSch.extractVal("Smallint_Tab",1,sqlp,conn);
			maxShortVal = new Short(sRetStr);
			
			if(oRetVal.equals(maxShortVal))
				logMsg("getShort returns the Maximum value " + oRetVal.toString());
			else
			{
				logErr("getShort() did not return the Maximum value");
				throw new Fault("Call to getShort Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getShort is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getShort Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Smallint_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetShort02
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getShort(int parameterIndex) method gets the value of a JDBC
	 *                    SMALLINT parameter as a short in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getShort(int parameterIndex) method to retrieve the minimum value
	 *                    of the Smallint_Tab. Extract the minimum value from the ctssql.stmt
	 *                    file.Compare this value with the value returned by the
	 *                    getShort(int parameterIndex). Both the values should be equal.
	 */
	public void testGetShort02() throws Fault
	{
		Short oRetVal = null;
		Short minShortVal = null;
		try
		{
			rsSch.createTab("Smallint_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Smallint_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.SMALLINT,0);
			cstmt.registerOutParameter(2,java.sql.Types.SMALLINT,15);
			cstmt.registerOutParameter(3,java.sql.Types.SMALLINT,0);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getShort(MIN_VAL)");

			//invoke getShort method
			short rRetVal = cstmt.getShort(2);
			oRetVal = new Short(rRetVal);
			String sRetStr = rsSch.extractVal("Smallint_Tab",2,sqlp,conn);
			minShortVal = new Short(sRetStr);
			
			if(oRetVal.equals(minShortVal))
				logMsg("getShort returns the Minimum value " + oRetVal.toString());
			else
			{
				logErr("getShort() did not return the Minimum value");
				throw new Fault("Call to getShort Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getShort is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getShort Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Smallint_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetShort03
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getShort(int parameterIndex) method gets the value of a JDBC
	 *                    SMALLINT parameter as a short in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getShort(int parameterIndex) method to retrieve the null value from
	 *                    the Smallint_Tab. Check if it returns null
	 */
	public void testGetShort03() throws Fault
	{
		try
		{
			rsSch.createTab("Smallint_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Smallint_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.SMALLINT,0);
			cstmt.registerOutParameter(2,java.sql.Types.SMALLINT,0);
			cstmt.registerOutParameter(3,java.sql.Types.SMALLINT,0);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getShort(NULL_VAL)");

			//invoke getShort method
			short rRetVal =cstmt.getShort(3);
			
			if(rRetVal == 0)
				logMsg("getShort returns the Null value " + rRetVal);
			else
			{
				logErr("getShort() did not return the Null value");
				throw new Fault("Call to getShort Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getShort is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getShort Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Smallint_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetString01
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getString(int parameterIndex) method retrieves the value of a
	 *                    JDBC CHAR, VARCHAR, or LONGVARCHAR parameter as a String in the
	 *                    Java programming language.If the value is SQL NULL, the result is
	 *                    null.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getString(int parameterIndex) method to retrieve a non null String value
	 *                    from Char_Tab. Extract the same String value from the ctssql.stmt file.Compare this
	 *                    value with the value returned by the getString(int parameterIndex).
	 *                    Both the values should be equal.
	 */
	public void testGetString01() throws Fault
	{
		try
		{
			rsSch.createTab("Char_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Char_Proc(?,?)}");
			logMsg("Before registerout parameter");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.CHAR);
			cstmt.registerOutParameter(2,java.sql.Types.CHAR);
			logMsg("after registerout parameter");

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getString(COFFEE_NAME)");
			//invoke getString method
			String sRetVal =cstmt.getString(1);
			sRetVal = sRetVal.trim();
			String sRetStr = rsSch.extractVal("Char_Tab",1,sqlp,conn);
			sRetStr=sRetStr.trim();
			logMsg("Value returned from table :" +sRetVal);
			logMsg("Value returned from ctssql.stmt  :" +sRetStr);

			if(sRetVal.equals(sRetStr.substring(1,sRetStr.length()-1)))
				logMsg("getString returns the Coffee Name" + sRetVal);
			else
			{
				logErr("getString() did not return the Coffee Name");
				throw new Fault("Call to getString Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logMsg("Inside SQLException block");
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getString is Failed!");
		}
		catch ( Exception e )
		{
			logMsg("Inside Exception block");
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getString Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Char_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetString02
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getString(int parameterIndex) method retrieves the value of a
	 *                    JDBC CHAR, VARCHAR, or LONGVARCHAR parameter as a String in the
	 *                    Java programming language.If the value is SQL NULL, the result is
	 *                    null.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getString(int parameterIndex) method.to retrieve the null value
	 *                    from Char_Tab. Check if it returns null
	 */
	public void testGetString02() throws Fault
	{
		try
		{
			rsSch.createTab("Char_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Char_Proc(?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.CHAR);
			cstmt.registerOutParameter(2,java.sql.Types.CHAR);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getString(NULL_VAL)");

			//invoke getString method
			String sRetVal =cstmt.getString(2);
			logMsg("Value returned from table :" +sRetVal);

			if(sRetVal ==  null)
				logMsg("getString returns the Coffee Name" + sRetVal);
			else
			{
				logErr("getString() did not return the Coffee Name");
				throw new Fault("Call to getString Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logMsg("Inside SQLException block");
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getString is Failed!");
		}
		catch ( Exception e )
		{
			logMsg("Inside Exception block");
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getString Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Char_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetInt01
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getInt(int parameterIndex) method gets the value of a JDBC
	 *                    INTEGER parameter as an int in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getInt(int parameterIndex) method to retrieve the maximum value
	 *                    from Integer_Tab. Extract the maximum value from the ctssql.stmt file.Compare this
	 *                    value with the value returned by the getInt(int parameterIndex).
	 *                    Both the values should be equal.
     */
	public void testGetInt01() throws Fault
	{
		Integer oRetVal = null;
		Integer maxIntegerVal = null;
		try
		{
			rsSch.createTab("Integer_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Integer_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.INTEGER);
			cstmt.registerOutParameter(2,java.sql.Types.INTEGER);
			cstmt.registerOutParameter(3,java.sql.Types.INTEGER);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getInt(MAX_VAL)");

			//invoke getInt method
			int nRetVal =cstmt.getInt(1);
			oRetVal = new Integer(nRetVal);
			String sRetStr = rsSch.extractVal("Integer_Tab",1,sqlp,conn);
			maxIntegerVal = new Integer(sRetStr);

			if(oRetVal.equals(maxIntegerVal))
				logMsg("getInt returns the Maximum value " + oRetVal.toString());
			else
			{
				logErr("getInt() did not return the Maximum value");
				throw new Fault("Call to getInt Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getInt is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getInt Failed!", e);
		}
		finally
		{
			try
			{
				
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Integer_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetInt02
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getInt(int parameterIndex) method gets the value of a JDBC
	 *                    INTEGER parameter as an int in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getInt(int parameterIndex) method to retrieve the minimum value
	 *                    from Integer_Tab. Extract the minimum value from the ctssql.stmt file.
	 *                    Compare this value with the value returned by the getInt(int parameterIndex).
	 *                    Both the values should be equal.
	 */
	public void testGetInt02() throws Fault
	{
		Integer oRetVal = null;
		Integer minIntegerVal = null;
		try
		{
			rsSch.createTab("Integer_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Integer_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.INTEGER);
			cstmt.registerOutParameter(2,java.sql.Types.INTEGER);
			cstmt.registerOutParameter(3,java.sql.Types.INTEGER);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getInt(MIN_VAL)");

			//invoke getInt method
			int nRetVal =cstmt.getInt(2);
			oRetVal = new Integer(nRetVal);
			String sRetStr = rsSch.extractVal("Integer_Tab",2,sqlp,conn);
			minIntegerVal = new Integer(sRetStr);

			if(oRetVal.equals(minIntegerVal))
				logMsg("getInt returns the Minimum value " + oRetVal.toString());
			else
			{
				logErr("getInt() did not return the Minimum value");
				throw new Fault("Call to getInt Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getInt is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getInt Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Integer_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetInt03
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getInt(int parameterIndex) method gets the value of a JDBC
	 *                    INTEGER parameter as an int in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.(See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getInt(int parameterIndex) method to retrieve the null value.
	 *                    Check if it returns null
	 */
	public void testGetInt03() throws Fault
	{
		try
		{
			rsSch.createTab("Integer_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Integer_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.INTEGER);
			cstmt.registerOutParameter(2,java.sql.Types.INTEGER);
			cstmt.registerOutParameter(3,java.sql.Types.INTEGER);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getInt(NULL_VAL)");

			//invoke getInt method
			int nRetVal =cstmt.getInt(3);

			if(nRetVal==0)
				logMsg("getInt returns the Null value " +nRetVal);
			else
			{
				logErr("getInt() did not return the Null value");
				throw new Fault("Call to getInt Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getInt is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getInt Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Integer_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetBoolean01
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The method getBoolean(int parameterIndex) gets the value of a JDBC
	 *                    BIT parameter as a boolean in the Java programming language.
	 *                    If the value is SQL NULL, the result is false.
	 *                    (See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getBoolean(int parameterIndex) method to retrieve the maximum value
	 *                    from Bit_Tab. Extract the maximum value from the ctssql.stmt
	 *                    file.Compare this value with the value returned by the
	 *                    getBoolean(int parameterIndex).Both the values should be equal.
	 */
	public void testGetBoolean01() throws Fault
	{
		Boolean oRetVal = null;
		Boolean maxBooleanVal = null;
		try
		{
			rsSch.createTab("Bit_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Bit_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.BIT);
			cstmt.registerOutParameter(2,java.sql.Types.BIT);
			cstmt.registerOutParameter(3,java.sql.Types.BIT);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getBoolean(MAX_VAL)");

			//invoke getBoolean method
			boolean bRetVal =cstmt.getBoolean(1);
			oRetVal = new Boolean(bRetVal);
			String sRetStr = rsSch.extractVal("Boolean_Tab",1,sqlp,conn);
			maxBooleanVal = new Boolean(sRetStr);

			if(oRetVal.equals(maxBooleanVal))
				logMsg("getBoolean returns the Maximum value " + oRetVal.toString());
			else
			{
				logErr("getBoolean() did not return the Maximum value");
				throw new Fault("Call to getBoolean Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getBoolean is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getBoolean Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Bit_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetBoolean02
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The method getBoolean(int parameterIndex) gets the value of a JDBC
	 *                    BIT parameter as a boolean in the Java programming language.
	 *                    If the value is SQL NULL, the result is false.
	 *                    (See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getBoolean(int parameterIndex) method.to retrieve the minimum value from
	 *                    Bit_Tab. Extract the minimum value from the ctssql.stmt file.
	 *                    Compare this value with the value returned by the getBoolean(int parameterIndex)
	 *                    Both the values should be equal.
	 */
	public void testGetBoolean02() throws Fault
	{
		Boolean oRetVal = null;
		Boolean minBooleanVal = null;
		try
		{
			rsSch.createTab("Bit_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Bit_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.BIT);
			cstmt.registerOutParameter(2,java.sql.Types.BIT);
			cstmt.registerOutParameter(3,java.sql.Types.BIT);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getBoolean(MIN_VAL)");

			//invoke getBoolean method
			boolean bRetVal =cstmt.getBoolean(2);
			oRetVal = new Boolean(bRetVal);
			String sRetStr = rsSch.extractVal("Boolean_Tab",2,sqlp,conn);
			minBooleanVal = new Boolean(sRetStr);

			if(oRetVal.equals(minBooleanVal))
				logMsg("getBoolean returns the Minimum value " + oRetVal.toString());
			else
			{
				logErr("getBoolean() did not return the Minimum value");
				throw new Fault("Call to getBoolean Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getBoolean is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getBoolean Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Bit_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetLong01
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getLong(int parameterIndex) Gets the value of a JDBC BIGINT
	 *                    parameter as a long in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.
	 *                    (See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getLong(int parameterIndex) method to retrieve the maximum value
	 *                    from Bigint_Tab. Extract the maximum value from the ctssql.stmt
	 *                    file.Compare this value with the value returned by the
	 *                    getLong(int parameterIndex). Both the values should be equal.
	 */
	public void testGetLong01() throws Fault
	{
		Long oRetVal = null;
		Long maxLongVal = null;
		try
		{
			rsSch.createTab("Bigint_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Bigint_Proc(?,?,?)}");

			//register the output parameters
			logMsg("Before registerout Parameter");
			cstmt.registerOutParameter(1,java.sql.Types.BIGINT);
			cstmt.registerOutParameter(2,java.sql.Types.BIGINT);
			cstmt.registerOutParameter(3,java.sql.Types.BIGINT);
			logMsg("after registerout Parameter");

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getLong(MAX_VAL)");

			//invoke getLong method
			long lRetVal =cstmt.getLong(1);
			oRetVal = new Long(lRetVal);
			String sRetStr = rsSch.extractVal("Bigint_Tab",1,sqlp,conn);
			maxLongVal = new Long(sRetStr);
			logMsg("Value returned from table :" +oRetVal);
			logMsg("Value returned from ctssql.stmt  :" +maxLongVal);

			if(oRetVal.equals(maxLongVal))
				logMsg("getLong returns the Maximum value " + oRetVal.toString());
			else
			{
				logErr("getLong() did not return the Maximum value");
				throw new Fault("Call to getLong Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getLong is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getLong Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Bigint_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetLong02
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getLong(int parameterIndex) Gets the value of a JDBC BIGINT
	 *                    parameter as a long in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.
	 *                    (See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getLong(int parameterIndex) method to retrieve the minimum value
	 *                    from Bigint_Tab. Extract the minimum value from the ctssql.stmt file.Compare this
	 *                    value with the value returned by the getLong(int parameterIndex)
	 *                    Both the values should be equal.
	 */
	public void testGetLong02() throws Fault
	{
		Long oRetVal = null;
		Long minLongVal = null;
		try
		{
			rsSch.createTab("Bigint_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Bigint_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.BIGINT);
			cstmt.registerOutParameter(2,java.sql.Types.BIGINT);
			cstmt.registerOutParameter(3,java.sql.Types.BIGINT);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getLong(MIN_VAL)");

			//invoke getLong method
			long lRetVal =cstmt.getLong(2);
			oRetVal = new Long(lRetVal);
			String sRetStr = rsSch.extractVal("Bigint_Tab",2,sqlp,conn);
			minLongVal = new Long(sRetStr);
			logMsg("Value returned from table :" +oRetVal);
			logMsg("Value returned from ctssql.stmt  :" +minLongVal);

			if(oRetVal.equals(minLongVal))
				logMsg("getLong returns the Minimum value " + oRetVal.toString());
			else
			{
				logErr("getLong() did not return the Minimum value");
				throw new Fault("Call to getLong Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getLong is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getLong Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Bigint_Tab",conn);
			}catch (Exception e) {};
		}
	}


	/*
	 * @testName:         testGetLong03
	 * @assertion:        A CallableStatement object provides a way to call stored procedures
	 *                    in a standard way for all RDBMSs.  It can take variable number of
	 *                    parameters used for input (IN parameters), output (OUT parameters)
	 *                    or both (INOUT parameters).  (See section 9.1 of JDBC 2.0 API
	 *                    Reference & Tutorial, Second Edition)
	 *
	 *                    The drivers must provide full support for CallableStatement methods
	 *                    that apply to SQL92 types.  All parameter types (IN, OUT, INOUT)
	 *                    must be supported (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition (J2EE) specification v 1.2)
	 *
	 *                    The getLong(int parameterIndex) Gets the value of a JDBC BIGINT
	 *                    parameter as a long in the Java programming language.
	 *                    If the value is SQL NULL, the result is 0.
	 *                    (See JDK 1.2.2 API documentation)
	 *
	 * @test_Strategy:    Get a CallableStatement object from the connection to the
	 *                    database.Execute the stored procedure and call the
	 *                    getLong(int parameterIndex) method to retrieve the null value
	 *                    from Bigint_Tab. Check if it returns null
	 */
	public void testGetLong03() throws Fault
	{
		try
		{
			rsSch.createTab("Bigint_Tab",sqlp,conn);

			// get the CallableStatement object
			cstmt = conn.prepareCall("{call Bigint_Proc(?,?,?)}");

			//register the output parameters
			cstmt.registerOutParameter(1,java.sql.Types.BIGINT);
			cstmt.registerOutParameter(2,java.sql.Types.BIGINT);
			cstmt.registerOutParameter(3,java.sql.Types.BIGINT);

			//execute the procedure
			cstmt.execute();
			logMsg("Calling CallableStatement.getLong(NULL_VAL)");

			//invoke getLong method
			long lRetVal =cstmt.getLong(3);
			logMsg("Value returned from table :" +lRetVal);

			if(lRetVal==0)
				logMsg("getLong returns the Null value " + lRetVal);
			else
			{
				logErr("getLong() did not return the Null value");
				throw new Fault("Call to getLong Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to getLong is Failed!");
		}
		catch ( Exception e )
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to getLong Failed!", e);
		}
		finally
		{
			try
			{
				if(cstmt!=null)
				{
					cstmt.close();
					cstmt=null;
				}
				rsSch.dropTab("Bigint_Tab",conn);
			}catch (Exception e) {};
		}
	}


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