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

/*
 * @(#)prepStmtClient3.java	1.5 02/01/12
 */

package com.sun.cts.tests.jdbc.ee.prepStmt.prepStmt3;

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 prepStmtClient3 class tests methods of DatabaseMetaData interface using
 * Sun's J2EE Reference Implementation.
 * @author
 * @version 1.8, 11/24/00
 */

public class prepStmtClient3 extends ServiceEETest implements Serializable
{
	private static final String testName = "jdbc.ee.prepStmt.prepStmt3";

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

	//Harness requirements 
	private transient Connection conn = null;
	private ResultSet rs = null;
	private Statement stmt = null;
	private DataSource ds1 = null;
	private PreparedStatement pstmt = null;
	private dbSchema dbSch = null;
	private rsSchema rsSch = null;
	private csSchema csSch=null;
	private String drManager = null;
	private transient DatabaseMetaData dbmd = null;
	private Properties sqlp = null;
	private Properties props = null;

	/* Run test in standalone mode */
	public static void main(String[] args)
	{
		prepStmtClient3 theTests = new prepStmtClient3();
		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 = new Properties();
				String sqlStmt = p.getProperty("rsQuery","");
				InputStream istr = new FileInputStream(sqlStmt);
				sqlp.load(istr);*/
				sqlp = p;
				props = 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);
				}
				stmt = conn.createStatement();
				rsSch = new rsSchema();
				csSch = new csSchema();
			}

			catch(SQLException ex)
			{
				logErr("SQL Exception : " + ex.getMessage());
			}
		}
		catch(Exception e)
		{
			logErr("Setup Failed!");
			TestUtil.printStackTrace(e);
		}
	}



	/*
	 * @testName:         testSetString01
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setString(int parameterIndex, String x) method sets the designated
	 *                    parameter to a Java String value. The driver converts this to an
	 *                    SQL VARCHAR or LONGVARCHAR value (depending on the argument's size
	 *                    relative to the driver's limits on VARCHAR values) when it sends
	 *                    it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setString(int parameterIndex, String x) method,update the
	 *                    column value with the maximum value of Char_Tab. Call the
	 *                    getString(String columnName) method to retrieve this value. Extract
	 *                    the maximum value from the ctssql.stmt file. Compare this value
	 *                    with the value returned by the getString(String columnName) method.
	 *                    Both the values should be equal.
	 */

	public void testSetString01() throws Fault
	{
		String maxStringVal = null;
		String rStringVal = null;

		try
		{
			rsSch.createTab("Char_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Char_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of String to be Updated 
			maxStringVal = rsSch.extractVal("Char_Tab",1,sqlp,conn);
			maxStringVal = maxStringVal.substring(1,maxStringVal.length()-1);
			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setString(1,maxStringVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Char_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rStringVal = rs.getString(1);
			rStringVal = rStringVal.trim();
			maxStringVal = maxStringVal.trim();

			logMsg("Returned String Value after Updation: " + rStringVal);
			logMsg("Value returned from ctssql.stmt: " + maxStringVal);

			if(rStringVal.equals(maxStringVal))
			{
				logMsg("setString Method sets the designated parameter to a String value ");
			}
			else
			{
				logErr("setString Method does not set the designated parameter to a String value ");
				throw new Fault("Call to setString Method is Failed!");
			}
		}

		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setString is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setString Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Char_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetTime01
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setTime(int parameterIndex, Time x) method sets the
	 *                    designated parameter to a java.sql.Time value. The driver
	 *                    converts this to an SQL TIME value when it sends it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setTime(int parameterIndex, Time x) method,update the
	 *                    column value with the Non-Null Time value. Call the getTime(int columnno)
	 *                    method to retrieve this value. Extract the Time value
	 *                    from the ctssql.stmt file. Compare this value with the value returned
	 *                    by the getTime(int columnno)  method. Both the values should be equal
	 */

	public void testSetTime01() throws Fault
	{
		Time brkTimeVal = null;
		Time rTimeVal = null;
		String sbrkTimeVal = null;

		try
		{
			rsSch.createTab("Time_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Time_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of Break_Time to be Updated 
			sbrkTimeVal = rsSch.extractVal("Time_Tab",1,sqlp,conn);
			sbrkTimeVal = sbrkTimeVal.substring(sbrkTimeVal.indexOf('\'')+1,sbrkTimeVal.lastIndexOf('\''));
			sbrkTimeVal = sbrkTimeVal.trim();

			//to convert the String into Time Val
			brkTimeVal = brkTimeVal.valueOf(sbrkTimeVal);
			logMsg("Time Value: " + brkTimeVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setTime(1,brkTimeVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Time_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rTimeVal = rs.getTime(1);
			logMsg("Returned Time Value after Updation: " + rTimeVal);
			logMsg("Value returned from ctssql.stmt: " + brkTimeVal);

			if(rTimeVal.equals(brkTimeVal))
			{
				logMsg("setTime Method sets the designated parameter to a Time value ");
			}
			else
			{
				logErr("setTime Method does not set the designated parameter to a Time value ");
				throw new Fault("Call to setTime Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setTime is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setTime is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Time_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetTime02
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setTime(int parameterIndex, String x, Calendar cal) method sets the
	 *                    designated parameter to the given java.sql.Time value, using the given
	 *                    Calendar object. The driver uses the Calendar object to construct an
	 *                    SQL TIME value, which the driver then sends to the database. With a Calendar
	 *                    object, the driver can calculate the time taking into account a custom
	 *                    timezone. If no Calendar object is specified, the driver uses the default
	 *                    timezone, which is that of the virtual machine running the application.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setTime(int parameterIndex, Time x, Calendar cal) method,update the
	 *                    column value with the Non-Null Time value using the Calendar Object. Call the
	 *                    getTime(int columnno) method to retrieve this value. Extract the Time value
	 *                    from the ctssql.stmt file. Compare this value with the value returned
	 *                    by the getTime(int columnno)  method. Both the values should be equal.
	 */

	public void testSetTime02() throws Fault
	{
		Time brkTimeVal = null;
		Time rTimeVal = null;
		String sbrkTimeVal = null;
		Calendar cal = null;

		try
		{
			rsSch.createTab("Time_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Time_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of Break_Time to be updated 
			sbrkTimeVal = rsSch.extractVal("Time_Tab",1,sqlp,conn);
			sbrkTimeVal = sbrkTimeVal.substring(sbrkTimeVal.indexOf('\'')+1,sbrkTimeVal.lastIndexOf('\''));
			sbrkTimeVal = sbrkTimeVal.trim();

			//to convert the String into Time Val
			brkTimeVal = brkTimeVal.valueOf(sbrkTimeVal);
			logMsg("Time Value: " + brkTimeVal);
			cal = Calendar.getInstance();

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setTime(1,brkTimeVal,cal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Time_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rTimeVal = rs.getTime(1,cal);
			logMsg("Returned Time Value after Updation: " + rTimeVal);
			logMsg("Value returned from ctssql.stmt:" + brkTimeVal);

			if((rTimeVal.toString()).trim().equals((brkTimeVal.toString()).trim()))
			{
				logMsg("setTime Method sets the designated parameter to a Time value ");
			}
			else
			{
				logErr("setTime Method does not set the designated parameter to a Time value ");
				throw new Fault("Call to setTime Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setTime is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setTime is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Time_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetTimestamp01
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setTimestamp(int parameterIndex,Timestamp x) method sets
	 *                    the designated parameter to a java.sql.Timestamp value.
	 *                    The driver converts this to an SQL TIMESTAMP value when it
	 *                    sends it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setTimestamp(int parameterIndex, Timestamp x) method,update the
	 *                    column value with the Non-Null Timestamp value. Call the getTimestamp(int columnno)
	 *                    method to retrieve this value. Extract the Timestamp value
	 *                    from the ctssql.stmt file. Compare this value with the value returned
	 *                    by the getTimestamp(int columnno)  method. Both the values should be equal.
	 */

	public void testSetTimestamp01() throws Fault
	{
		Timestamp inTimeVal = null;
		Timestamp rTimestampVal = null;
		String sinTimeVal = null;

		try
		{
			rsSch.createTab("Timestamp_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Timestamp_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of InTime to be updated
			sinTimeVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn);
			sinTimeVal = sinTimeVal.substring(sinTimeVal.indexOf('\'')+1,sinTimeVal.lastIndexOf('\''));

			//to convert the String into Timestamp Val
			inTimeVal = inTimeVal.valueOf(sinTimeVal);
			logMsg("Timestamp Value: " + inTimeVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setTimestamp(1,inTimeVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Timestamp_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rTimestampVal = rs.getTimestamp(1);
			logMsg("Returned Timestamp Value after Updation: " + rTimestampVal);
			logMsg("Value returned from ctssql.stmt  :" + inTimeVal);

			if(rTimestampVal.equals(inTimeVal))
			{
				logMsg("setTimestamp Method sets the designated parameter to a Timestamp value ");
			}
			else
			{
				logErr("setTimestamp Method does not set the designated parameter to a Timestamp value ");
				throw new Fault("Call to setTimestamp Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to setTimestamp is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to setTimestamp is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Timestamp_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetTimestamp02
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setTimestamp(int parameterIndex, String x, Calendar cal) method sets the
	 *                    designated parameter to the given java.sql.Timestamp value, using the given
	 *                    Calendar object. The driver uses the Calendar object to construct an
	 *                    SQL TIMESTAMP value, which the driver then sends to the database. With a Calendar
	 *                    object, the driver can calculate the time taking into account a custom
	 *                    timezone. If no Calendar object is specified, the driver uses the default
	 *                    timezone, which is that of the virtual machine running the application.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setTimestamp(int parameterIndex, Time x, Calendar cal) method,update the
	 *                    column value with the Non-Null Timestamp value using the Calendar Object. Call the
	 *                    getTimestamp(int columnno) method to retrieve this value. Extract the Timestamp value
	 *                    from the ctssql.stmt file. Compare this value with the value returned
	 *                    by the getTimestamp(int columnno) method. Both the values should be equal.
	 */

	public void testSetTimestamp02() throws Fault
	{
		Timestamp inTimeVal = null;
		Timestamp rTimestampVal = null;
		String sinTimeVal = null;
		Calendar cal = null;

		try
		{
			rsSch.createTab("Timestamp_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Timestamp_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of InTime to be Updated 
			sinTimeVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn);
			sinTimeVal = sinTimeVal.substring(sinTimeVal.indexOf('\'')+1,sinTimeVal.lastIndexOf('\''));

			//to convert the String into Timestamp Val
			inTimeVal = inTimeVal.valueOf(sinTimeVal);
			logMsg("Timestamp Value: " + inTimeVal);
			cal = Calendar.getInstance();

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setTimestamp(1,inTimeVal,cal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Timestamp_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();
			rTimestampVal = rs.getTimestamp(1,cal);
			logMsg("Returned Timestamp Value after Updation: " + rTimestampVal);
			logMsg("Value returned from ctssql.stmt  :" + inTimeVal);

			if(rTimestampVal.equals(inTimeVal))
			{
				logMsg("setTimestamp Method sets the designated parameter to a Timestamp value ");
			}
			else
			{
				logErr("setTimestamp Method does not set the designated parameter to a Timestamp value ");
				throw new Fault("Call to setTimestamp Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setTimestamp is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setTimestamp is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Timestamp_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetString02
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setString(int parameterIndex, String x) method sets the designated
	 *                    parameter to a Java String value. The driver converts this to an
	 *                    SQL VARCHAR or LONGVARCHAR value (depending on the argument's size
	 *                    relative to the driver's limits on VARCHAR values) when it sends
	 *                    it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using setString(int parameterIndex, String x),update the column
	 *                    with the maximum value which is a SQL VARCHAR. Call the
	 *                    getString(int ColumnIndex) method to retrieve this value. Extract
	 *                    the maximum value as a String from the ctssql.stmt file.
	 *                    Compare this value with the value returned by the getString method.
	 *                    Both the values should be equal.
	 */

	public void testSetString02() throws Fault
	{
		String maxStringVal = null;
		String rStringVal = null;

		try
		{
			// to create the Varchar Table
			rsSch.createTab("Varchar_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Varchar_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of String to be Updated 
			maxStringVal = rsSch.extractVal("Varchar_Tab",1,sqlp,conn);
			maxStringVal = maxStringVal.substring(1,maxStringVal.length()-1);
			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setString(1,maxStringVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Null_Val_Query = sqlp.getProperty("Varchar_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rStringVal = rs.getString(1);
			rStringVal = rStringVal.trim();
			maxStringVal = maxStringVal.trim();
			logMsg("Returned String Value after Updation: " + rStringVal);
			logMsg("Value returned from ctssql.stmt: " + maxStringVal);

			if(rStringVal.equals(maxStringVal))
			{
				logMsg("setString Method sets the designated parameter to a String value ");
			}
			else
			{
				logErr("setString Method does not set the designated parameter to a String value ");
				throw new Fault("Call to setString Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setString is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setString is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Varchar_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetFloat01
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setFloat(int parameterIndex, float x) sets the designated parameter
	 *                    to a Java float value. The driver converts this to an SQL FLOAT value
	 *                    when it sends it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using setFloat(int parameterIndex,float x),update the column with the
	 *                    minimum value of Real_Tab.
	 *                    Now execute a query to get the minimum value and retrieve the result
	 *                    of the query using the getFloat(int columnIndex) method.Compare the
	 *                    returned value, with the minimum value extracted from the ctssql.stmt file.
	 *                    Both of them should be equal.
	 */

	public void testSetFloat01() throws Fault
	{
		float rFloatVal = 0;
		float minFloatVal = 0;

		try
		{
			// to create the REAL Table
			rsSch.createTab("Real_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Real_Tab_Max_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of Minimum value to be Updated
			String sminFloatVal = rsSch.extractVal("Real_Tab",2,sqlp,conn);

			//to convert the String into Float value
			minFloatVal = Float.parseFloat(sminFloatVal);
			logMsg("Float Value: " + minFloatVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setFloat(1,minFloatVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Max_Val_Query = sqlp.getProperty("Real_Query_Max","");
			logMsg(Max_Val_Query);
			rs = stmt.executeQuery(Max_Val_Query);
			rs.next();
			rFloatVal = rs.getFloat(1);
			logMsg("Returned Float Value after Updation: "+ rFloatVal);
			logMsg("Value returned from ctssql.stmt: " + minFloatVal);

			if(rFloatVal == minFloatVal)
			{
				logMsg("setFloat Method sets the designated parameter to a Float value ");
			}
			else
			{
				logErr("setFloat Method does not set the designated parameter to a Float value ");
				throw new Fault("Call to setFloat Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setFloat is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setFloat is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Real_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetFloat02
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setFloat(int parameterIndex, float x) sets the designated parameter
	 *                    to a Java float value. The driver converts this to an SQL FLOAT value
	 *                    when it sends it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using setFloat(int parameterIndex,float x),update the column with the
	 *                    maximum value of Real_Tab.
	 *                    Now execute a query to get the maximum value and retrieve the result
	 *                    of the query using the getFloat(int columnIndex) method.Compare the
	 *                    returned value, with the maximum value extracted from the ctssql.stmt file.
	 *                    Both of them should be equal.
	 */

	public void testSetFloat02() throws Fault
	{
		float maxFloatVal = 0;
		float rFloatVal = 0;

		try
		{
			rsSch.createTab("Real_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Real_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of Maximum value to be Updated 
			String smaxFloatVal = rsSch.extractVal("Real_Tab",1,sqlp,conn);

			//to convert the String into Float value
			maxFloatVal = Float.parseFloat(smaxFloatVal);
			logMsg("Float Value: " + maxFloatVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setFloat(1,maxFloatVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Real_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rFloatVal = rs.getFloat(1);
			logMsg("Returned Float Value after Updation: " + rFloatVal);
			logMsg("Value returned from ctssql.stmt: " + maxFloatVal);

			if(rFloatVal == maxFloatVal)
			{
				logMsg("setFloat Method sets the designated parameter to a Float value ");
			}
			else
			{
				logErr("setFloat Method does not set the designated parameter to a Float value ");
				throw new Fault("Call to setFloat Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setFloat is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setFloat is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Real_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetBytes01
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setBytes(int parameterIndex, byte[] x) sets the designated
	 *                    parameter to a Java array of bytes. The driver converts this to
	 *                    an SQL VARBINARY or LONGVARBINARY (depending on the argument's
	 *                    size relative to the driver's limits on VARBINARY values) when
	 *                   it sends it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    execute the precompiled SQL Statement for updating Non-Null value
	 *                    from Binary_Tab by calling setBytes(int parameterIndex, byte[] x)
	 *                    and call the getBytes(int) method to check and it should return a Byte Array
	 */

	public void testSetBytes01() throws Fault
	{
		String binarySize = null;

		try
		{
			binarySize = props.getProperty("binarySize");
			rsSch.createTab("Binary_Tab",sqlp,conn);

			String sPrepStmt = sqlp.getProperty("Binary_Tab_Val_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			int bytearrsize = Integer.parseInt(binarySize);
			logMsg("Binary Size: " + bytearrsize);
			byte[] bytearr = new byte[bytearrsize];
			String sbyteval = null;

			//to get the bytearray value
			for (int count = 0;count<bytearrsize;count++)
			{
				sbyteval = Integer.toString(count%255);
				bytearr[count] = Byte.parseByte(sbyteval);
			}

			//get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);

			//Setting the value
			pstmt.setBytes(1,bytearr);
			pstmt.executeUpdate();

			//query from the database to check the call of pstmt.executeUpdate
			String Binary_Val_Query = sqlp.getProperty("Binary_Query_Val","");
			logMsg("Query String: " +Binary_Val_Query);
			rs = stmt.executeQuery(Binary_Val_Query);
			rs.next();

			//invoke getBytes method
			byte[] oRetVal = rs.getBytes(1);
			for(int i=0;i<bytearrsize;i++)
			{
				if(oRetVal[i] != bytearr[i])
				{
					logErr("setBytes did not set the proper byte array values");
					throw new Fault("Call to setBytes Failed!");
				}
			}
			logMsg("setBytes sets the proper byte array values");
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setBytes is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " +e.getMessage());
			throw new Fault("Call to setBytes Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				
				rsSch.dropTab("Binary_Tab",conn);
			}
			catch(Exception e)
			{
				logMsg("Exception in finally block" +e);
			}
		}
	}



	/*
	 * @testName:         testSetBytes02
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setBytes(int parameterIndex, byte[] x) sets the designated
	 *                    parameter to a Java array of bytes. The driver converts this to
	 *                    an SQL VARBINARY or LONGVARBINARY (depending on the argument'
	 *                    size relative to the driver's limits on VARBINARY values) when
	 *                    it sends it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    execute the precompiled SQL Statement for updating Non-Null value
	 *                    from Varbinary_Tab by calling setBytes(int parameterIndex, byte[] x)
	 *                    and call the getBytes(int) method to check and it should return a Byte Array
	 */

	public void testSetBytes02() throws Fault
	{
		String varbinarySize = null;

		try
		{
			rsSch.createTab("Varbinary_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Varbinary_Tab_Val_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);
			varbinarySize = props.getProperty("varbinarySize");

			int bytearrsize = Integer.parseInt(varbinarySize);
			logMsg("Varbinary Size: " + bytearrsize);
			byte[] bytearr = new byte[bytearrsize];
			String sbyteval = null;

			//to get the bytearray value
			for(int count=0;count<bytearrsize;count++)
			{
				sbyteval = Integer.toString(count%255);
				bytearr[count] = Byte.parseByte(sbyteval);
			}

			//get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);

			//Setting the value
			pstmt.setBytes(1,bytearr);
			pstmt.executeUpdate();

			//query from the database to check the call of pstmt.executeUpdate
			String Varbinary_Val_Query = sqlp.getProperty("Varbinary_Query_Val","");
			logMsg("Query String: " +Varbinary_Val_Query);
			rs = stmt.executeQuery(Varbinary_Val_Query);
			rs.next();

			//invoke getBytes method
			byte[] oRetVal = rs.getBytes(1);

			for(int i=0;i<bytearrsize;i++)
			{
				if(oRetVal[i] != bytearr[i])
				{
					logErr("setBytes did not set the proper byte array values");
						throw new Fault("Call to setBytes Failed!");
				}
			}

			logMsg("setBytes sets the proper byte array values");
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setBytes is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " +e.getMessage());
			throw new Fault("Call to setBytes Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				rsSch.dropTab("Varbinary_Tab",conn);
			}
			catch(Exception e)
			{
				logMsg("Exception in finally block" +e);
			}
		}
	}



	/*
	 * @testName:         testSetBytes03
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setBytes(int parameterIndex, byte[] x) sets the designated
	 *                    parameter to a Java array of bytes. The driver converts this to
	 *                    an SQL VARBINARY or LONGVARBINARY (depending on the argument's
	 *                    size relative to the driver's limits on VARBINARY values) when
	 *                    it sends it to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    execute the precompiled SQL Statement for updating Non-Null value
	 *                    from Longvarbinary_Tab by calling setBytes(int parameterIndex, byte[] x)
	 *                    and call the getBytes(int) method to check and it should return a Byte Array
	 */
	
	public void testSetBytes03() throws Fault
	{
		byte retByteArr[] = null;

		try
		{
			rsSch.createTab("Longvarbinary_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Longvarbinary_Tab_Val_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			// to get the byte array value to be updated 
			String binsize = props.getProperty("longvarbinarySize");
			int bytearrsize = Integer.parseInt(binsize);
			logMsg("Longvarbinary Size: " + bytearrsize);

			byte[] bytearr = new byte[bytearrsize];
			String sbyteval = null;

			// to get the bytearray value
			for(int count=0;count<bytearrsize;count++)
			{
				sbyteval = Integer.toString(count%255);
				bytearr[count] = Byte.parseByte(sbyteval);
			}

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setBytes(1,bytearr);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Longvarbinary_Val_Query = sqlp.getProperty("Longvarbinary_Query_Val","");
			logMsg(Longvarbinary_Val_Query);
			rs = stmt.executeQuery(Longvarbinary_Val_Query);
			rs.next();
			retByteArr = rs.getBytes(1);

			for(int i=0;i<bytearrsize;i++)
			{
				logMsg("byteArray Value: " + retByteArr[i]);
				if(retByteArr[i] != bytearr[i])
				{
					logErr("setBytes Method does not set the designated parameter to a byte array");
					throw new Fault("Call to setBytes Method is Failed!");
				}
			}
			logMsg("setBytes Method sets the designated parameter to a Byte Array Value");
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setBytes is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setBytes is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Longvarbinary_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject01
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the
	 *                    value of the designated parameter using the given object.
	 *                    The second parameter must be of type Object; therefore, the
	 *                    java.lang equivalent objects should be used for built-in types.
	 *
	 *                    The JDBC specification specifies a standard mapping from Java
	 *                    Object types to SQL types. The given argument will be converted
	 *                    to the corresponding SQL type before being sent to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the
	 *                    column Null_Val with the maximum value of Char_Tab. Call the
	 *                    getObject(int columnno) method to retrieve this value. Extract
	 *                    the maximum value from the ctssql.stmt file. Compare this value
	 *                    with the value returned by the getObject(int columnno) method.
	 *                    Both the values should be equal.
	 */

	public void testSetObject01() throws Fault
	{
		String maxStringVal = null;
		String rStringVal = null;

		try
		{
			rsSch.createTab("Char_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Char_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of String to be Updated 
			maxStringVal = rsSch.extractVal("Char_Tab",1,sqlp,conn);
			maxStringVal = maxStringVal.substring(1,maxStringVal.length()-1);
			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxStringVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Char_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rStringVal = rs.getObject(1).toString();
			rStringVal = rStringVal.trim();
			maxStringVal = maxStringVal.trim();
			logMsg("Returned String Value after Updation: " + rStringVal);
			logMsg("Value returned from ctssql.stmt: " + maxStringVal);

			if(rStringVal.equals(maxStringVal))
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Char_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject02
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL4 statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the
	 *                    value of the designated parameter using the given object.
	 *                    The second parameter must be of type Object; therefore, the
	 *                    java.lang equivalent objects should be used for built-in types.
	 *
	 *                    The JDBC specification specifies a standard mapping from Java
	 *                    Object types to SQL types. The given argument will be converted
	 *                    to the corresponding SQL type before being sent to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the
	 *                    column Null_val with the maximum value of Varchar_Tab. Call the
	 *                    getObject(int columnno) method to retrieve this value. Extract
	 *                    the maximum value from the ctssql.stmt file. Compare this value
	 *                    with the value returned by the getObject(int columnNo) method.
	 *                    Both the values should be equal.
	 */

	public void testSetObject02() throws Fault
	{
		String maxStringVal = null;
		String rStringVal = null;

		try
		{
			rsSch.createTab("Varchar_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Varchar_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of String to be Updated
			maxStringVal = rsSch.extractVal("Varchar_Tab",1,sqlp,conn);
			maxStringVal = maxStringVal.substring(1,maxStringVal.length()-1);
			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxStringVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Null_Val_Query = sqlp.getProperty("Varchar_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rStringVal = rs.getObject(1).toString();
			rStringVal = rStringVal.trim();
			maxStringVal = maxStringVal.trim();
			logMsg("Returned String Value after Updation: " + rStringVal);
			logMsg("Value returned from ctssql.stmt: " + maxStringVal);

			if(rStringVal.equals(maxStringVal))
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{ 
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Varchar_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject03
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL4 statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the
	 *                    value of the designated parameter using the given object.
	 *                    The second parameter must be of type Object; therefore, the
	 *                    java.lang equivalent objects should be used for built-in types.
	 *
	 *                    The JDBC specification specifies a standard mapping from Java
	 *                    Object types to SQL types. The given argument will be converted
	 *                    to the corresponding SQL type before being sent to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the
	 *                    column Null_val with the maximum value of Longvarchar_Tab. Call the
	 *                    getObject(int columnno) method to retrieve this value. Extract
	 *                    the maximum value from the ctssql.stmt file. Compare this value
	 *                    with the value returned by the getObject(int columnNo) method.
	 *                    Both the values should be equal.
	 */

	public void testSetObject03() throws Fault
	{
		String maxStringVal = null;
		String rStringVal = null;

		try
		{
			rsSch.createTab("Longvarcharnull_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Longvarchar_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Value of String to be Updated 
			maxStringVal = rsSch.extractVal("Longvarcharnull_Tab",1,sqlp,conn);
			maxStringVal = maxStringVal.substring(1,maxStringVal.length()-1);
			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxStringVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Longvarchar_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rStringVal = rs.getObject(1).toString();
			rStringVal = rStringVal.trim();
			maxStringVal = maxStringVal.trim();
			logMsg("Returned String Value after Updation: " + rStringVal);
			logMsg("Value returned from ctssql.stmt: " + maxStringVal);

			if(rStringVal.equals(maxStringVal))
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Longvarcharnull_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject04
	 * @assertion:        A Prepared Statement object provides a way of calling
	 *                    precompiled SQL4 statements.It can take one or more parameters
	 *                    as input arguments(IN parameters). (See section 11.1.6 of
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the
	 *                    value of the designated parameter using the given object.
	 *                    The second parameter must be of type Object; therefore, the
	 *                    java.lang equivalent objects should be used for built-in types.
	 *
	 *                    The JDBC specification specifies a standard mapping from Java
	 *                    Object types to SQL types. The given argument will be converted
	 *                    to the corresponding SQL type before being sent to the database.
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the
	 *                    column Null_val with the maximum value of Numeric_Tab. Call the
	 *                    getObject(int columnno) method to retrieve this value. Extract 
	 *                    the maximum value from the ctssql.stmt file. Compare this value
	 *                    with the value returned by the getObject(int columnNo) method.
	 *                    Both the values should be equal.
	 */

	public void testSetObject04() throws Fault
	{
		BigDecimal maxBigDecimalVal = null;
		BigDecimal rBigDecimalVal = null;
		String smaxBigDecimalVal = null;

		try
		{
			// to create the Numeric Table
			rsSch.createTab("Numeric_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Numeric_Tab_Min_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Maximum Value of BigDecimal to be Updated 
			smaxBigDecimalVal = rsSch.extractVal("Numeric_Tab",1,sqlp,conn);
			maxBigDecimalVal = new BigDecimal(smaxBigDecimalVal);
			logMsg("Maximum BigDecimal Value: " + maxBigDecimalVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxBigDecimalVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Min_Val_Query = sqlp.getProperty("Numeric_Query_Min","");
			logMsg(Min_Val_Query);
			rs = stmt.executeQuery(Min_Val_Query);
			rs.next();

			rBigDecimalVal = (BigDecimal) rs.getObject(1);
			logMsg("Returned BigDecimal Value after Updation: " + rBigDecimalVal);
			logMsg("Value returned from ctssql.stmt: " + maxBigDecimalVal);

			if(rBigDecimalVal.compareTo(maxBigDecimalVal) == 0)
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Numeric_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject05
	 * @assertion:        A Prepared Statement object provides a way of calling 
	 *                    precompiled SQL4 statements.It can take one or more parameters 
	 *                    as input arguments(IN parameters). (See section 11.1.6 of 
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement 
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise 
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the 
	 *                    value of the designated parameter using the given object. 
	 *                    The second parameter must be of type Object; therefore, the 
	 *                    java.lang equivalent objects should be used for built-in types. 
	 *
     *                    The JDBC specification specifies a standard mapping from Java 
     *                    Object types to SQL types. The given argument will be converted 
     *                    to the corresponding SQL type before being sent to the database. 
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the 
	 *                    column Null_val with the minimum value of Numeric_Tab. Call the 
	 *                    getObject(int columnno) method to retrieve this value. Extract 
	 *                    the minimum value from the ctssql.stmt file. Compare this value 
	 *                    with the value returned by the getObject(int columnNo) method. 
	 *                    Both the values should be equal.
	 */

	public void testSetObject05() throws Fault
	{
		BigDecimal minBigDecimalVal = null;
		BigDecimal rBigDecimalVal = null;
		String sminBigDecimalVal = null;

		try
		{
			// to create the Numeric Table
			rsSch.createTab("Numeric_Tab",sqlp,conn);

			// to update Null value column with Minimum value 
			String sPrepStmt = sqlp.getProperty("Numeric_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);
			
			//to extract the Maximum Value of BigDecimal to be Updated 
			sminBigDecimalVal = rsSch.extractVal("Numeric_Tab",2,sqlp,conn);
			minBigDecimalVal = new BigDecimal(sminBigDecimalVal);
			logMsg("Minimum BigDecimal Value: " + minBigDecimalVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,minBigDecimalVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Null_Val_Query = sqlp.getProperty("Numeric_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rBigDecimalVal = (BigDecimal) rs.getObject(1);
			logMsg("Returned BigDecimal Value after Updation: " + rBigDecimalVal);
			logMsg("Value returned from ctssql.stmt: " + minBigDecimalVal);

			if(rBigDecimalVal.compareTo(minBigDecimalVal) == 0)
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Numeric_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject06
	 * @assertion:        A Prepared Statement object provides a way of calling 
	 *                    precompiled SQL4 statements.It can take one or more parameters 
	 *                    as input arguments(IN parameters). (See section 11.1.6 of 
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement 
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise 
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the 
	 *                    value of the designated parameter using the given object. 
	 *                    The second parameter must be of type Object; therefore, the 
	 *                    java.lang equivalent objects should be used for built-in types. 
	 *
	 *                    The JDBC specification specifies a standard mapping from Java 
	 *                    Object types to SQL types. The given argument will be converted 
	 *                    to the corresponding SQL type before being sent to the database. 
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the 
	 *                    column Min_val with the maximum value of Decimal_Tab. Call the 
	 *                    getObject(int columnno) method to retrieve this value. Extract 
	 *                    the maximum value from the ctssql.stmt file. Compare this value 
	 *                    with the value returned by the getObject(int columnNo) method. 
	 *                    Both the values should be equal.
	 */

	public void testSetObject06() throws Fault
	{
		BigDecimal maxBigDecimalVal = null;
		BigDecimal rBigDecimalVal = null;
		String smaxBigDecimalVal = null;

		try
		{
			// to create the Decimal Table
			rsSch.createTab("Decimal_Tab",sqlp,conn);
			String sPrepStmt = sqlp.getProperty("Decimal_Tab_Min_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Maximum Value of BigDecimal to be Updated 
			smaxBigDecimalVal = rsSch.extractVal("Decimal_Tab",1,sqlp,conn);
			maxBigDecimalVal = new BigDecimal(smaxBigDecimalVal);
			logMsg("Maximum BigDecimal Value: " + maxBigDecimalVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxBigDecimalVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Min_Val_Query = sqlp.getProperty("Decimal_Query_Min","");
			logMsg(Min_Val_Query);
			rs = stmt.executeQuery(Min_Val_Query);
			rs.next();

			rBigDecimalVal = (BigDecimal) rs.getObject(1);
			logMsg("Returned BigDecimal Value after Updation: " + rBigDecimalVal);
			logMsg("Value returned from ctssql.stmt: " + maxBigDecimalVal);

			if(rBigDecimalVal.compareTo(maxBigDecimalVal) == 0)
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Decimal_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject07
	 * @assertion:        A Prepared Statement object provides a way of calling 
	 *                    precompiled SQL4 statements.It can take one or more parameters 
	 *                    as input arguments(IN parameters). (See section 11.1.6 of 
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement 
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise 
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the 
	 *                    value of the designated parameter using the given object. 
	 *                    The second parameter must be of type Object; therefore, the 
	 *                    java.lang equivalent objects should be used for built-in types. 
	 *
	 *                    The JDBC specification specifies a standard mapping from Java 
	 *                    Object types to SQL types. The given argument will be converted 
	 *                    to the corresponding SQL type before being sent to the database. 
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the 
	 *                    column Null_val with the minimum value of Decimal_Tab. Call the 
	 *                    getObject(int columnno) method to retrieve this value. Extract 
	 *                    the minimum value from the ctssql.stmt file. Compare this value 
	 *                    with the value returned by the getObject(int columnNo) method. 
	 *                    Both the values should be equal.
	 */

	public void testSetObject07() throws Fault
	{
		BigDecimal minBigDecimalVal = null;
		BigDecimal rBigDecimalVal = null;
		String sminBigDecimalVal = null;

		try
		{
			// to create the Decimal Table
			rsSch.createTab("Decimal_Tab",sqlp,conn);

			// to update Null value column with Minimum value 
			String sPrepStmt = sqlp.getProperty("Decimal_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Maximum Value of BigDecimal to be Updated 
			sminBigDecimalVal = rsSch.extractVal("Decimal_Tab",2,sqlp,conn);
			minBigDecimalVal = new BigDecimal(sminBigDecimalVal);
			logMsg("Minimum BigDecimal Value: " + minBigDecimalVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,minBigDecimalVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Null_Val_Query = sqlp.getProperty("Decimal_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			rBigDecimalVal = (BigDecimal) rs.getObject(1);
			logMsg("Returned BigDecimal Value after Updation:" + rBigDecimalVal);
			logMsg("Value returned from ctssql.stmt: " + minBigDecimalVal);

			if(rBigDecimalVal.compareTo(minBigDecimalVal) == 0)
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Decimal_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject08
	 * @assertion:        A Prepared Statement object provides a way of calling 
	 *                    precompiled SQL4 statements.It can take one or more parameters 
	 *                    as input arguments(IN parameters). (See section 11.1.6 of 
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement 
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise 
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the 
	 *                    value of the designated parameter using the given object. 
	 *                    The second parameter must be of type Object; therefore, the 
	 *                    java.lang equivalent objects should be used for built-in types. 
	 *
	 *                    The JDBC specification specifies a standard mapping from Java 
	 *                    Object types to SQL types. The given argument will be converted 
	 *                    to the corresponding SQL type before being sent to the database. 
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the 
	 *                    column Min_val with the maximum value of Bit_Tab. Call the 
	 *                    getObject(int columnno) method to retrieve this value. Extract 
	 *                    the maximum value from the ctssql.stmt file. Compare this value 
	 *                    with the value returned by the getObject(int columnNo) method. 
	 *                    Both the values should be equal.
	 */

	public void testSetObject08() throws Fault
	{
		Boolean maxBooleanVal = null;
		Boolean rBooleanVal = null;
		String  smaxBooleanVal = null;
		boolean booleanVal;

		try
		{
			// to create the Bit Table
			rsSch.createTab("Bit_Tab",sqlp,conn);

			// to update Minimum (false) value column with maximum (true)
			String sPrepStmt = sqlp.getProperty("Bit_Tab_Min_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Maximum Value of Boolean to be Updated 
			smaxBooleanVal = rsSch.extractVal("Bit_Tab",1,sqlp,conn);

			String testType = new String("BOOLEAN");
			if(csSch.supportsType(testType,conn))
			{
				logMsg("database supports Boolean datatype.");
				maxBooleanVal = new Boolean(smaxBooleanVal);
			}
			else
			{
				booleanVal= (smaxBooleanVal.trim().equals("1"))? true : false;
				maxBooleanVal = new Boolean(booleanVal);
			}
			logMsg("Maximum Boolean Value :" + maxBooleanVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxBooleanVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			//to get the query string
			String Min_Val_Query = sqlp.getProperty("Bit_Query_Min","");
			logMsg(Min_Val_Query);
			rs = stmt.executeQuery(Min_Val_Query);
			rs.next();
			
			rBooleanVal = (Boolean) rs.getObject(1);
			logMsg("Returned Boolean Value after Updation: " + rBooleanVal);
			logMsg("Value returned from ctssql.stmt: " + maxBooleanVal);

			if(rBooleanVal.equals(maxBooleanVal))
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Bit_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:         testSetObject09
	 * @assertion:        A Prepared Statement object provides a way of calling 
	 *                    precompiled SQL4 statements.It can take one or more parameters 
	 *                    as input arguments(IN parameters). (See section 11.1.6 of 
	 *                    JDBC 2.0 API Reference & Tutorial,Second Edition)
	 *
	 *                    The drivers must provide full support for Prepared Statement 
	 *                    methods. (See section 6.2.2.3 of Java2 Platform Enterprise 
	 *                    Edition(J2EE) specification v 1.2).
	 *
	 *                    The setObject(int parameterIndex, Object x) method sets the 
	 *                    value of the designated parameter using the given object. 
	 *                    The second parameter must be of type Object; therefore, the 
	 *                    java.lang equivalent objects should be used for built-in types. 
	 *
	 *                    The JDBC specification specifies a standard mapping from Java 
	 *                    Object types to SQL types. The given argument will be converted 
	 *                    to the corresponding SQL type before being sent to the database. 
	 *
	 * @test_Strategy:    Get a PreparedStatement object from the connection to the database.
	 *                    Using the setObject(int parameterIndex, Object x) method,update the 
	 *                    column Null_val with the minimum value of Bit_Tab. Call the 
	 *                    getObject(int columnno) method to retrieve this value. Extract 
	 *                    the minimum value from the ctssql.stmt file. Compare this value 
	 *                    with the value returned by the getObject(int columnNo) method. 
	 *                    Both the values should be equal.
	 */

	public void testSetObject09() throws Fault
	{
		Boolean minBooleanVal = null;
		Boolean rBooleanVal = null;
		String  sminBooleanVal = null;
		boolean booleanVal;

		try
		{
			// to create the Bit Table
			rsSch.createTab("Bit_Tab",sqlp,conn);

			// to update Null value column with Minimum value 
			String sPrepStmt = sqlp.getProperty("Bit_Tab_Null_Update","");
			logMsg("Prepared Statement String: " + sPrepStmt);

			//to extract the Minimum Value of Boolean to be Updated 
			sminBooleanVal = rsSch.extractVal("Bit_Tab",2,sqlp,conn);
			
			String testType = new String("BOOLEAN");
			if(csSch.supportsType(testType,conn))
			{
				logMsg("database supports Boolean datatype.");
				minBooleanVal = new Boolean(sminBooleanVal);
			}
			else
			{
				booleanVal= (sminBooleanVal.trim().equals("1"))? true : false;
				minBooleanVal = new Boolean(booleanVal);
			}
			logMsg("Minimum Boolean Value :" + minBooleanVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,minBooleanVal);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Null_Val_Query = sqlp.getProperty("Bit_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();
			
			rBooleanVal = (Boolean) rs.getObject(1);
			
			logMsg("Returned Boolean Value after Updation: " +rBooleanVal );
			logMsg("Value returned from ctssql.stmt: " + minBooleanVal);

			if(rBooleanVal.equals(minBooleanVal))
			{
				logMsg("setObject Method sets the designated parameter with the Object");
			}
			else
			{
				logErr("setObject Method does not set the designated parameter with the Object");
				throw new Fault("Call to setObject Method is Failed!");
			}
		}
		catch(SQLException sqle)
		{
			logErr("SQL Exception: " + sqle.getMessage());
			throw new Fault("Call to setObject is Failed!");
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to setObject is Failed!", e);
		}

		finally
		{
			try
			{
				if(rs != null)
				{
					 rs.close();
					 rs = null;
				}
				if(pstmt != null)
				{
					 pstmt.close();
					 pstmt = null;
				}
				if(stmt != null)
				{
					 stmt.close();
					 stmt = null;
				}
				rsSch.dropTab("Bit_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



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