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

/*
 * @(#)prepStmtClient15.java	1.8 02/01/12
 */

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

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

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

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

	//Harness requirements 

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

	/* Run test in standalone mode */
	public static void main(String[] args)
	{
		prepStmtClient15 theTests = new prepStmtClient15();
		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();
				dbmd = conn.getMetaData();
				rsSch = new rsSchema();
				csSch = new csSchema();
			}
			catch(SQLException ex)
			{
				logErr("SQL Exception: " + ex.getMessage());
			}
		}
		catch(Exception e)
		{
			logErr("Setup Failed!");
			TestUtil.printStackTrace(e);
		}
	}



	/*
	 * @testName:       testSetObject223
	 * @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 of Longvarchar_Tab with the minimum (mfg date) value of 
	 *                  Date_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (mfg date) 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 testSetObject223() throws Fault
	{
		String maxStringVal = null;
		java.sql.Date maxDateVal = null;
		String rStringVal = null;
		java.sql.Date rDateVal = 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 Date to be Updated to Null Column of LongVarchar Table
			maxStringVal = rsSch.extractVal("Date_Tab",1,sqlp,conn);
			maxStringVal = maxStringVal.substring(maxStringVal.indexOf('\'')+1,maxStringVal.lastIndexOf('\''));
			maxDateVal = java.sql.Date.valueOf(maxStringVal);

			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxDateVal,java.sql.Types.LONGVARCHAR);
			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();
			logMsg("Returned String Value after Updation: " + rStringVal);
			rDateVal = java.sql.Date.valueOf(rStringVal);
			logMsg("Returned String Value after Updation: " + rDateVal);
			logMsg("Value returned from ctssql.stmt: " + maxDateVal);

			if(rDateVal.equals(maxDateVal))
			{
				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:       testSetObject224
	 * @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 of Date_Tab with the maximum (mfg date) value of 
	 *                  Date_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (mfg date) 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 testSetObject224() throws Fault
	{
		java.sql.Date mfgDateVal = null;
		String sMfgStringVal = null;
		java.sql.Date rDateVal = null;

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

			//to extract the Value of Date to be Updated to Null Column of Date Table
			sMfgStringVal = rsSch.extractVal("Date_Tab",1,sqlp,conn);
			sMfgStringVal = sMfgStringVal.substring(sMfgStringVal.indexOf('\'')+1,sMfgStringVal.lastIndexOf('\''));
			logMsg("Date Value: " + sMfgStringVal);

			// to convert String value into java.sql.Date value
			mfgDateVal = java.sql.Date.valueOf(sMfgStringVal);
			logMsg("Date Value Extracted :" + mfgDateVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,mfgDateVal,java.sql.Types.DATE);
			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("Date_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			java.util.Date orDateVal = (java.util.Date) rs.getObject(1);
			long ld = orDateVal.getTime();
			
			rDateVal = new java.sql.Date(ld);
			logMsg("Returned Date Value after Updation: " + rDateVal);
			logMsg("Value returned from ctssql.stmt: " + mfgDateVal);

			if(rDateVal.equals(mfgDateVal))
			{
				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("Date_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:       testSetObject225
	 * @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 of Timestamp_Tab with the maximum (mfg timestamp) value of 
	 *                  Timestamp_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (mfg timestamp) 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 testSetObject225() throws Fault
	{
		java.sql.Date mfgDateVal = null;
		String sMfgStringVal = null;
		java.sql.Timestamp rTimestampVal = null;
		Timestamp mfgTimestampVal = null;
		java.sql.Date rDateVal = 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 Timestamp to be Updated to Null Value of Timestamp Table
			sMfgStringVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn);
			sMfgStringVal = sMfgStringVal.substring(sMfgStringVal.indexOf('\'')+1,sMfgStringVal.lastIndexOf('\''));
			logMsg("String Value for Timestamp:" + sMfgStringVal);
			mfgTimestampVal = Timestamp.valueOf(sMfgStringVal);
			logMsg("Timestamp Value: " + mfgTimestampVal);
			sMfgStringVal = sMfgStringVal.substring(0,sMfgStringVal.indexOf(' '));
			logMsg("String Value for Date:" + sMfgStringVal);

			mfgDateVal = java.sql.Date.valueOf(sMfgStringVal);
			logMsg("Date Value: " + mfgDateVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,mfgDateVal,java.sql.Types.TIMESTAMP);
			pstmt.executeUpdate();

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

			rTimestampVal = (java.sql.Timestamp) rs.getObject(1);
			logMsg("Returned Timestamp Value after Updation: " + rTimestampVal);
			String str = rTimestampVal.toString();
			str = str.substring(0,str.indexOf(' '));
			rDateVal = java.sql.Date.valueOf(str);

			logMsg("Returned Date Value after Updation: " + rDateVal);
			logMsg("Value returned from ctssql.stmt: " + mfgDateVal);

			if(rDateVal.equals(mfgDateVal))
			{
				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("Timestamp_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:       testSetObject226
	 * @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 of Char_Tab with the maximum (mfg time) value of 
	 *                  Time_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (mfg time) 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 testSetObject226() throws Fault
	{
		String sbrkTimeVal = null;
		String rStringVal = null;
		java.sql.Time brkTimeVal = null;
		java.sql.Time rTimeVal = 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 Time to be Updated to Null Value of Char Table
			sbrkTimeVal = rsSch.extractVal("Time_Tab",1,sqlp,conn); 
			sbrkTimeVal = sbrkTimeVal.substring(sbrkTimeVal.indexOf('\'')+1,sbrkTimeVal.lastIndexOf('\''));
			sbrkTimeVal = sbrkTimeVal.trim();

			brkTimeVal = java.sql.Time.valueOf(sbrkTimeVal);
			logMsg("String Value: " + brkTimeVal.toString());

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,brkTimeVal,java.sql.Types.CHAR);
			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();

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

			if(rTimeVal.equals(brkTimeVal))
			{
				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:       testSetObject227
	 * @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 of Varchar_Tab with the maximum (mfg time)value of 
	 *                  Time_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (mfg time) 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 testSetObject227() throws Fault
	{
		String sbrkTimeVal = null;
		String rStringVal = null;
		java.sql.Time brkTimeVal = null;
		java.sql.Time rTimeVal = 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 Time to be Updated to be updated to Null Value of Varchar Table
			sbrkTimeVal = rsSch.extractVal("Time_Tab",1,sqlp,conn); 
			sbrkTimeVal = sbrkTimeVal.substring(sbrkTimeVal.indexOf('\'')+1,sbrkTimeVal.lastIndexOf('\''));
			sbrkTimeVal = sbrkTimeVal.trim();

			brkTimeVal = java.sql.Time.valueOf(sbrkTimeVal);
			logMsg("String Value: " + brkTimeVal.toString());

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,brkTimeVal,java.sql.Types.VARCHAR);
			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("Varchar_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();

			//logMsg("Returned String Value after Updation: " + rStringVal);
			rTimeVal = rs.getTime(1);

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

			if(rTimeVal.toString().trim().equals(brkTimeVal.toString().trim()))
			{
				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:       testSetObject228
	 * @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 of Longvarchar_Tab with the maximum (mfg time) value of 
	 *                  Time_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (mfg time) 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 testSetObject228() throws Fault
	{
		String sbrkTimeVal = null;
		String rStringVal = null;
		java.sql.Time brkTimeVal = null;
		java.sql.Time rTimeVal = 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 Time to be Updated for Null Value of Longvarchar Table
			sbrkTimeVal = rsSch.extractVal("Time_Tab",1,sqlp,conn); 
			sbrkTimeVal = sbrkTimeVal.substring(sbrkTimeVal.indexOf('\'')+1,sbrkTimeVal.lastIndexOf('\''));
			sbrkTimeVal = sbrkTimeVal.trim();

			brkTimeVal = java.sql.Time.valueOf(sbrkTimeVal);
			logMsg("String Value: " + brkTimeVal.toString());

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,brkTimeVal,java.sql.Types.LONGVARCHAR);
			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 = (String)rs.getObject(1);
			rStringVal = rStringVal.trim();
			logMsg("Returned String Value after Updation: " + rStringVal);
			rTimeVal = java.sql.Time.valueOf(rStringVal);

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

			if(rTimeVal.equals(brkTimeVal))
			{
				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:       testSetObject229
	 * @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 of Time_Tab with the maximum (mfg time) value of 
	 *                  Time_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (mfg time) 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 testSetObject229() throws Fault
	{
		java.sql.Time brkTimeVal = null;
		String sBrkTimeVal = null;
		java.sql.Time rTimeVal = 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 Time to be Updated 
			sBrkTimeVal = rsSch.extractVal("Time_Tab",1,sqlp,conn);
			sBrkTimeVal = sBrkTimeVal.substring(sBrkTimeVal.indexOf('\'')+1,sBrkTimeVal.lastIndexOf('\''));
			logMsg("Time Value: " + sBrkTimeVal);

			// to convert String value into java.sql.Time value
			brkTimeVal = brkTimeVal.valueOf(sBrkTimeVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,brkTimeVal,java.sql.Types.TIME);
			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();

			java.util.Date orTimeVal = (java.util.Date) rs.getObject(1);
			
			long lt = orTimeVal.getTime();
			
			rTimeVal = new java.sql.Time(lt);
			
			logMsg("Returned Time Value after Updation: " + rTimeVal);
			logMsg("Value returned from ctssql.stmt: " + brkTimeVal);

			if(rTimeVal.toString().trim().equals(brkTimeVal.toString().trim()))
			{
				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("Time_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:       testSetObject230
	 * @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 of Char_Tab with the maximum (brktime) value of 
	 *                  Timestamp_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (brktime) 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 testSetObject230() throws Fault
	{
		String maxStringVal = null;
		String rStringVal = null;
		Timestamp maxTimestampVal = null;
		Timestamp rTimestampVal = null;

		try
		{
			// to create the Char table
			rsSch.createTab("Char_Tab",sqlp,conn);

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

			//to extract the Value of Timestamp to be Updated 
			maxStringVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn); 
			maxStringVal = maxStringVal.substring(maxStringVal.indexOf('\'')+1,maxStringVal.lastIndexOf('\''));
			logMsg("String Value: " + maxStringVal);
			maxTimestampVal = java.sql.Timestamp.valueOf(maxStringVal);
			logMsg("String Value: " + maxTimestampVal.toString());

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxTimestampVal,java.sql.Types.CHAR);
			pstmt.executeUpdate();

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

			rStringVal = (String)rs.getObject(1);
			rStringVal = rStringVal.trim();
			logMsg("Returned String Value after Updation: " + rStringVal);
			rTimestampVal = java.sql.Timestamp.valueOf(rStringVal);
			logMsg("Returned Timestamp Value after Updation: " + rTimestampVal);

			if (rTimestampVal.equals(maxTimestampVal))
			{
				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:       testSetObject231
	 * @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 of Varchar_Tab with the maximum (brktime) value of 
	 *                  Timestamp_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (brktime) 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 testSetObject231() throws Fault
	{
		Timestamp maxTimestampVal = null;
		String maxStringVal = null;
		String rStringVal = null;
		Timestamp rTimestampVal = 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 Timestamp to be Updated 
			maxStringVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn);
			maxStringVal = maxStringVal.substring(maxStringVal.indexOf('\'')+1,maxStringVal.lastIndexOf('\''));
			maxTimestampVal = Timestamp.valueOf(maxStringVal);
			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxTimestampVal,java.sql.Types.VARCHAR);
			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();
			//logMsg("Returned String Value after Updation: " + rStringVal);
			rTimestampVal = Timestamp.valueOf(rStringVal);
			logMsg("Returned String Value after Updation: " + rTimestampVal);
			logMsg("Value returned from ctssql.stmt: " + maxTimestampVal);

			if(rTimestampVal.equals(maxTimestampVal))
			{
				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:       testSetObject232
	 * @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 Min_Val of Longvarchar_Tab with the maximum (brktime) value of 
	 *                  Timestamp_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (brktime) 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 testSetObject232() throws Fault
	{
		String maxStringVal = null;
		Timestamp maxTimestampVal = null;
		String rStringVal = null;
		Timestamp rTimestampVal = null;

		try
		{
			// to drop the table Longvarchar table
			rsSch.createTab("Longvarcharnull_Tab",sqlp,conn);

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

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

			logMsg("String Value: " + maxStringVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,maxTimestampVal,java.sql.Types.LONGVARCHAR);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			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();
			//logMsg("Returned String Value after Updation: " + rStringVal);
			rTimestampVal = Timestamp.valueOf(rStringVal);
			logMsg("Returned String Value after Updation: " + rTimestampVal);
			logMsg("Value returned from ctssql.stmt: " + maxTimestampVal);

			if(rTimestampVal.equals(maxTimestampVal))
			{
				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:       testSetObject233
	 * @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 of Date_Tab with the maximum (brktime) value of 
	 *                  Timestamp_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (brktime) 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 testSetObject233() throws Fault
	{
		String sInTimeVal = null;
		String sRetVal = null;
		java.sql.Date inDateVal = null;
		java.sql.Date rDateVal = null;

		try
		{
			// to create the Date table
			rsSch.createTab("Date_Tab",sqlp,conn);

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

			//to extract the Value of Timestamp to be Updated 
			sInTimeVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn);
			logMsg("Timestamp Value: " + sInTimeVal);
			//inTimeVal = Timestamp.valueOf(sInTimeVal);

			sInTimeVal = sInTimeVal.substring(sInTimeVal.indexOf('\'')+1,sInTimeVal.lastIndexOf('\''));
			sInTimeVal = sInTimeVal.substring(0,sInTimeVal.indexOf(' '));

			inDateVal = java.sql.Date.valueOf(sInTimeVal);
			logMsg("Date Value after extraction :" + inDateVal);
			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,inDateVal,java.sql.Types.DATE);
			pstmt.executeUpdate();

			//to query from the database to check the call of pstmt.executeUpdate
			String Null_Val_Query = sqlp.getProperty("Date_Query_Null","");
			logMsg(Null_Val_Query);
			rs = stmt.executeQuery(Null_Val_Query);
			rs.next();
			
			java.util.Date orDateVal = (java.util.Date)rs.getObject(1);
			long ld = orDateVal.getTime();
			
			rDateVal = new java.sql.Date(ld);
			
			logMsg("Returned Value after Updation: " + rDateVal);
			logMsg("Value returned from ctssql.stmt: " + inDateVal);

			if(rDateVal.equals(inDateVal))
			{
				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("Date_Tab",conn);
			}
			catch(Exception e){ }
		}

	}



	/*
	 * @testName:       testSetObject234
	 * @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 of Timestamp_Tab with the maximum (brktime) value of 
	 *                  Time_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (brktime) 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 testSetObject234() throws Fault
	{
		java.sql.Time brkTimeVal = null;
		String sBrkStringVal = null;
		java.sql.Time rTimeVal = null;
		Timestamp brkTimestampVal = null;

		try
		{
			// to create the Time table
			rsSch.createTab("Time_Tab",sqlp,conn);

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

			//to extract the Value of Timestamp to be Updated 
			sBrkStringVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn);
			sBrkStringVal = sBrkStringVal.substring(sBrkStringVal.indexOf('\'')+1,sBrkStringVal.lastIndexOf('\''));
			logMsg("String Value for Timestamp:" + sBrkStringVal);

			brkTimestampVal = Timestamp.valueOf(sBrkStringVal);
			logMsg("Timestamp Value: " + brkTimestampVal);

			sBrkStringVal = sBrkStringVal.substring(sBrkStringVal.indexOf(' ')+1,sBrkStringVal.length());			
			logMsg("String Value for Time:" + sBrkStringVal);  
			brkTimeVal = java.sql.Time.valueOf(sBrkStringVal);
			logMsg("Time Value: " + brkTimeVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,brkTimestampVal,java.sql.Types.TIME);
			pstmt.executeUpdate();

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

			java.util.Date orTimeVal = (java.util.Date) rs.getObject(1);
			long lt = orTimeVal.getTime();
			
			rTimeVal = new java.sql.Time(lt);
			
			logMsg("Returned Time Value after Updation: " + rTimeVal);
			logMsg("Value returned from ctssql.stmt: " + brkTimeVal);

			if(rTimeVal.toString().trim().equals(brkTimeVal.toString().trim()))
			{
				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("Time_Tab",conn);
			}
			catch(Exception e){ }
		}
	}



	/*
	 * @testName:       testSetObject235
	 * @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 of Timestamp_Tab with the maximum (brktime) value of 
	 *                  Timestamp_Tab. Call the getObject(int columnno) method to retrieve this 
	 *                  value. Extract the maximum (brktime) 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 testSetObject235() throws Fault
	{
		java.sql.Timestamp inTimeVal = null;
		String sInTimeVal = null;
		java.sql.Timestamp inTimestampVal = null ;
		java.sql.Timestamp rTimestampVal = 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 Timestamp to be Updated 
			sInTimeVal = rsSch.extractVal("Timestamp_Tab",1,sqlp,conn);
			logMsg("Timestamp Value: " + sInTimeVal);
			//inTimeVal = Timestamp.valueOf(sInTimeVal);

			sInTimeVal = sInTimeVal.substring(sInTimeVal.indexOf('\'')+1,sInTimeVal.lastIndexOf('\''));
			logMsg("Timestamp Value after extraction :" + sInTimeVal);			
			inTimestampVal = java.sql.Timestamp.valueOf(sInTimeVal);

			// get the PreparedStatement object
			pstmt = conn.prepareStatement(sPrepStmt);
			pstmt.setObject(1,inTimestampVal,java.sql.Types.TIMESTAMP);
			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 = (java.sql.Timestamp) rs.getObject(1);
			logMsg("Returned Value after Updation:" + rTimestampVal);
			logMsg("Value returned from ctssql.stmt: " + inTimestampVal);

			if(rTimestampVal.equals(inTimestampVal))
			{
				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("Timestamp_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");
		}
	}
}
