
/**
 * File Name			:	GBMDBCommonComponent.java
 * Purpose				:	Contains the general methods related to Database operations
 * @author Raghavan R
 * @version GBM 2.1.0
 * Creation Date		:	16-10-03
 * Modification Log	:
 * Modified By			:	Prakash T.L.
 * Modified Date		:	18-Feb-2004
 * Purpose				:	Localized Connection & Statement objects
 *							for proper management of Database Conections.
*/

package com.gbm.common;
import java.sql.*;
import java.util.*;
//import java.text.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;

public class GBMDBCommonComponent {

//	Connection con = null ; Commented by Prakash (11/02/2004)
//	Statement stmt = null;  Commented by Prakash (11/02/2004)
	//GBMDBConnectionComp gbmDBConnComp = new GBMDBConnectionComp ();

	private long lStartTime ;
	private long lEndTime ;
   /**
	* Method taken from GBMGeneralComponent.
	* <p>
	* Executes the given query, populates the records into the HashMap and returns the HashMap.
	* The HashMap has unique keys (1,2,3...). Its values are ArrayLists. Each record in the table
	* corresponds to a ArrayList with the fields as its elements.
	* <p>
	* @param  gbmgc object reference of gbmgeneralcomponent.
	*             <br> sQuery - contains the query to execute.
	* 			  <br> vErrorObjects - ArrayList error object to hold the error.
	* @return 	  htValues contains the result
	* @Author					:	Vasudevan G
	* @Date						:	17-08-01
	* @Modification History		:
	* @Modified By				:
	* @Modified Date			:
    **/

	public HashMap getResultSet(GBMGeneralComponent gbmgc, String sQuery, ArrayList vErrorObjects) {
		final String ERROR_WHILE_FETCHING_DATA 	= "E6009003";
		final String NO_RECORDS_FOUND 			= "E6001053";
		String sColumnValue;
		HashMap htValues = new HashMap();

		Connection con = null;  // Added by Prakash (11/02/2004)
		Statement stmt = null;  // Added by Prakash (11/02/2004)

		// Statement stmtLocal = null; Commented by Prakash (11/02/2004)
	    ResultSet rs = null;
		ResultSetMetaData rsmd = null;

		int iHashCount;
		iHashCount = 0;
		sColumnValue = "";

		//System.out.println("Query " + sQuery);
		try {
			//createConnection(vErrorObjects);

			/*	Commented by Prakash (11/02/2004)
			if ( ( con == null ) || ( con.isClosed () ) ) {		Commented by Prakash (11/02/2004)
				con = gbmDBConnComp.getConnection ( vErrorObjects );
			}*/

			con = GBMDBPool.getConnection (  );	// Added by Prakash (11/02/2004)
			stmt = con.createStatement();

			lStartTime = getCurrentTime ();
			rs = stmt.executeQuery(sQuery);
			lEndTime = getCurrentTime ();
//			printTimeDifferences ( lStartTime, lEndTime );
			rsmd = rs.getMetaData();

			while (rs.next()) {
				iHashCount++;
				ArrayList vColumnValues = new ArrayList();
				//Parse the columns and add the column values into the ArrayList Object
				for (int i=1;i<=rsmd.getColumnCount();i++) {
					sColumnValue = rs.getString(rsmd.getColumnName(i));
					if (sColumnValue != null) {
						vColumnValues.add(sColumnValue);
					} else {
						vColumnValues.add("");
					}
				}
				//Put the key value and the corresponding ArrayList object into the HashMap
				htValues.put(Integer.toString(iHashCount),vColumnValues);
			}
			/*	If No Records Found for the given Query,
				populate Error Object and put in into ArrayList	*/

			/*if (htValues.isEmpty()) {
				GBMErr err = new GBMErr();
				err.sCode = NO_RECORDS_FOUND;
				vErrorObjects.clear();
				err.sDesc = getMessageDescription(err.sCode, vErrorObjects);
				vErrorObjects.add(err);
			}*/

		//	rs.close();
		//	stmt.close();
		}
		catch(SQLException se) {
			//Populate the Error Object and put it into the ArrayList
			vErrorObjects.clear();
			gbmgc.setError(ERROR_WHILE_FETCHING_DATA,"",true,vErrorObjects);
			//System.out.println("SQL Exception in getResultset");
			se.printStackTrace();
		}
		catch(Exception e) {
			//Populate the Error Object and put it into the ArrayList
			vErrorObjects.clear();
			gbmgc.setError(ERROR_WHILE_FETCHING_DATA,"",true,vErrorObjects);
			e.printStackTrace();
		}finally {
			try {
				if (rs != null ) rs.close();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -rs.close() method in finally block  ");
			}
			try {
				if ( stmt != null ) stmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return htValues;
	}//end method getResultSet

	/**
	 * Executes the given query, populates and returns the resultset.
	 * @param sQuery holds the query in string type data
	 *        vErrorObjects - holder for the error object
	 *        bIsReturnRS -  boolean flag
	 * @return rs ResultSet Data
	 * @Author				:	Venkatesan. R.
	 * @Date				:	26-03-02
	 * @Modification History
	 * @Modified By			:
	 * @Modified Date		:
	 **/


	public GBMResultPaging getResultSet(GBMGeneralComponent gbmgc, String sQuery, ArrayList vErrorObjects, GBMResultPaging oGBMResultPaging) {
		final String ERROR_WHILE_FETCHING_DATA = "E6009003";
		final String NO_RECORDS_FOUND = "E6001053";
		String sColumnValue;
		HashMap htValues = new HashMap();
	    ResultSet rs = null;
		ResultSetMetaData rsmd = null;

		Connection con = null; // Added by Prakash (11/02/2004)
		Statement stmt = null;  // Added by Prakash (11/02/2004)

		int iHashCount;
		iHashCount = 0;
		sColumnValue = "";
		//System.out.println("Query " + sQuery);
		try {
			//createConnection(vErrorObjects);

			/* Commented by Prakash (11/02/2004)
			if ( ( con == null ) || ( con.isClosed () ) ) {
				con = gbmDBConnComp.getConnection ( vErrorObjects );
			}*/

			con = GBMDBPool.getConnection ();	// Added by Prakash (11/02/2004)
			stmt = con.createStatement ();
			lStartTime = getCurrentTime ();
			rs = stmt.executeQuery(sQuery);
			lEndTime = getCurrentTime ();
//			printTimeDifferences ( lStartTime, lEndTime );
			oGBMResultPaging.storeResult ( rs );
			//rs.close ();
			//stmt.close ();
		}
		catch(Exception e) {
			//Populate the Error Object and put it into the ArrayList

			vErrorObjects.clear();
			gbmgc.setError(ERROR_WHILE_FETCHING_DATA,"",true,vErrorObjects);

			e.printStackTrace();
		}finally {
			try {
					if (rs != null ) rs.close();
				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method -rs.close() method in finally block  ");
				}
				try {
					if ( stmt != null ) stmt.close ();

				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
				}
				try {
					if ( con != null ) con.close ();
				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return oGBMResultPaging;

	}//end method getResultSet





	/**
	* Executes the Insert, Update and Delete Statements.
	* @param  sQuery hold the query string
	*         vErrorObjects - holder for error object
	* @return iRecordsAffected No of Records Affected by the Operation.
	* @Author				:	Vasudevan G
	* @Date					:	17-08-01
	* @Modification History
	* @Modified By			:
	* @Modified Date		:
    **/

	public int executeQuery(GBMGeneralComponent gbmgc, String sQuery, ArrayList vErrorObjects) {
		//System.out.println("Query " + sQuery);

		Connection con = null; // Added by Prakash (11/02/2004)
		Statement stmt = null;  // Added by Prakash (11/02/2004)

		//createConnection(new ArrayList());
		int iRecordsAffected  = -1;
		try	{
			/* 	Commented by Prakash (11/02/2004)
			if ( ( con == null ) || ( con.isClosed () ) ) {
				con = gbmDBConnComp.getConnection ( vErrorObjects );
			}*/

			con = GBMDBPool.getConnection (); // Added by Prakash (11/02/2004)
			stmt = con.createStatement ();

			//System.out.println(stmt);
			lStartTime = getCurrentTime ();
  			iRecordsAffected = stmt.executeUpdate(sQuery);
			lEndTime = getCurrentTime ();
//			printTimeDifferences ( lStartTime, lEndTime );
			/*	Patch added by Vasudevan G on 20/11/01
				Commit statement introduced to forcefully commit the transaction.
				Required only when updating any table existing in Finacle whose view
				exists in GBM Database	*/
			con.commit();
			/*	End of Patch	*/

			//System.out.println("Records Affected " + iRecordsAffected );
			if (iRecordsAffected == 0) {
				vErrorObjects.clear();
				gbmgc.setError("E6001015","",true,vErrorObjects);

			}
		}
		catch(Exception e) {
			e.printStackTrace();
		}finally {

			try {
				if ( stmt != null ) stmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}		return iRecordsAffected;
	}//end method executeQuery


   /**
	*Executes the Queries as a Batch for any Update to the Database
	* @param vQuery contains the Batch Update Queries
	*        vErrorObjects - holder for error objects
	* @return iTotalRecordsAffected total no of records affected
	* @author				:	Vasudevan G
	* @Date				    :	11-09-01
	* @Modification History
	* @Modified By			:
	* @Modified Date		:
    **/

	public int executeBatchQuery(GBMGeneralComponent gbmgc, ArrayList vQuery, ArrayList vErrorObjects) throws Exception {
		int iTotalRecordsAffected = 0;
		int iReturnVal = 0;

		Connection con = null; // Added by Prakash (11/02/2004)
		Statement stmtBatch = null;
		try {
			//createConnection(new ArrayList());
			/* Commented by Prakash (11/02/2004)
			if ( ( con == null ) || ( con.isClosed () ) ) {
				con = gbmDBConnComp.getConnection ( vErrorObjects );
			}*/

			con = GBMDBPool.getConnection (); // Added by Prakash (11/02/2004)

			//System.out.println("Query Size " + vQuery.size());
			//Set AutoCommit to false
			con.setAutoCommit(false);
			stmtBatch = con.createStatement();
			//Parse the Array and add the Queries to the Current Batch
			for(int i=0;i<vQuery.size();i++) {
				//System.out.println("Query " +i+" " + vQuery.get(i));
				lStartTime = getCurrentTime ();
				iReturnVal = stmtBatch.executeUpdate((String)vQuery.get(i));
				lEndTime = getCurrentTime ();
//				printTimeDifferences ( lStartTime, lEndTime );
				//System.out.println("Return value in gen " + iReturnVal);
				iTotalRecordsAffected += iReturnVal;
			}
			//stmtBatch.close();
			//con.commit();
			con.setAutoCommit(true);
		}
		catch(Exception e) {
			iTotalRecordsAffected = -1;
			con.rollback();
			con.setAutoCommit(true);
			e.printStackTrace();
		}finally {

			try {
				if ( stmtBatch != null ) stmtBatch.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		//System.out.println("Total Records Affected " + iTotalRecordsAffected);
		return iTotalRecordsAffected;
	}//end method executeBatchQuery




   /**
	* To execute procedure at the database.
	* @param gbmgc Reference for GeneralComponent object
	*        sProcedure - String object to store the procedure name
	*        vInParameters - ArrayList object to store the in parameters
	*        vOutParameters - ArrayList object to store the output parameter
	*        vErrorObjects - ArrayList object to store the error object
	* @author				:	Priya J
	* @Date				:	21-09-2001
	* @Modification History
	* @Modified By			:
	* @Modified Date		:
    **/


	public boolean executeProcedure(GBMGeneralComponent gbmgc, String sProcedure, ArrayList vInParameters, ArrayList vOutParameters, ArrayList vErrorObjects) {
		//System.out.println (" >>> inside method executeProcedure of GBMDBCommonComponent ");
		String sQuery = "";

		Connection con = null; // Added by Prakash (11/02/2004)
		CallableStatement cStmt = null;

		int iInParamSize = 0;
		int iOutParamSize = 0;
		int iCount = 1;
		int iCnt = 0;

		if (vInParameters == null)
			return false;

		if (vInParameters.size() <= 0)
			return false;

		//Output parameter made mandatory to return error code, if any
		if (vOutParameters == null)
			return false;

		/*if (vOutParameters.size() <= 0)
			return false;*/

		iInParamSize = vInParameters.size();
		iOutParamSize = vOutParameters.size();

		if (sProcedure == null || sProcedure.trim().equals(""))
			return false;


		//Form the Callable Statement
		sQuery = "{call " + sProcedure + "(";
		for(iCnt=0; iCnt < (iInParamSize+iOutParamSize); iCnt++) {
			sQuery += "?,";
		}
		sQuery = sQuery.substring(0, sQuery.lastIndexOf(","));
		sQuery += ")}";

		//System.out.println("out param "+iOutParamSize);
		try{
			//System.out.println (" >> before con - inside GBMDBCommonComponent ");
			//createConnection(new ArrayList());
			/* Added by Prakash 11/02/2004
			if ( ( con == null ) || ( con.isClosed () ) ) {
				con = gbmDBConnComp.getConnection ( vErrorObjects );
			}*/

			con = GBMDBPool.getConnection (); // Added by Prakash 11/02/2004
			con.setAutoCommit(false);

			cStmt = con.prepareCall(sQuery);

		//Register Output Parameters, vDataTypes values should be like TYPES.VARCHAR, TYPES.DATE, etc
			if (iOutParamSize > 0) {
				//System.out.println("Registering output parameters...");
				while (iCount <= iOutParamSize) {
				//System.out.println("output parameters..." + iInParamSize+iCount);
				cStmt.registerOutParameter(iInParamSize+iCount, Types.VARCHAR);
				iCount++;
				}
			}

			//Based on types of datatype of the input parameter, set the callable statement
			for(iCnt=0;iCnt < iInParamSize; iCnt++) {
				//System.out.println(iCnt+1);
				//System.out.println((String)vInParameters.get(iCnt));
				cStmt.setString(iCnt+1, (String)vInParameters.get(iCnt));
			}
			//Execute the callable statement
			if (cStmt.executeUpdate() <= 0) {
				//System.out.println("Execution failed");
				cStmt.close();
				return false;
			}

			iCount = 1;
			for(iCnt=0;iCnt < iOutParamSize; iCnt++) {
				vOutParameters.set(iCnt, cStmt.getString(iInParamSize+iCount));
				iCount++;
			}

			con.commit();
			//cStmt.close();
		} catch(SQLException eSQL) {
			//System.out.println("*******SQL EXCEPTION*******");
			try{
				con.rollback();
			}catch(SQLException eSE) {
				//System.out.println("*******SQL EXCEPTION - ROLLBACK*******");
				eSE.printStackTrace();
			}
			eSQL.printStackTrace();
			return false;
		}finally {

			try {
				if ( cStmt != null ) cStmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return true;
	}//end method execute Procedure



	/**
	 * To execute oracle function at the database
	 * @author				:	Priya J
	 * @Date				:	18-10-2001
	 * @Modification History
	 * @Modified By			:
	 * @Modified Date		:
     **/


	public String executeFunction(GBMGeneralComponent gbmgc, String sFunction, ArrayList vInParameters, ArrayList vOutParameters, ArrayList vErrorObjects) {
		String sQuery = "";
		String sResult = "NO_RESULT";

		Connection con = null; // Added by Prakash (11/02/2004)
		CallableStatement cStmt = null;

		int iInParamSize = 0;
		int iOutParamSize = 0;
		int iCount = 1;
		int iCnt = 0;
		int iSetCount = 2;

		if (vInParameters == null)
			return sResult;

		if (vInParameters.size() <= 0)
			return sResult;

		//Output parameter made mandatory to return error code, if any
		//System.out.println("In DB component Before vout params");
		if (vOutParameters == null)
			return sResult;
		//System.out.println("In DB component After vout params");
		/*if (vOutParameters.size() <= 0)
			return false;*/

		iInParamSize = vInParameters.size();
		iOutParamSize = vOutParameters.size();

		if (sFunction == null || sFunction.trim().equals(""))
			return sResult;
		try {
		//createConnection(vErrorObjects);
		/* Commented by Prakash 11/02/2004
		if ( ( con == null ) || ( con.isClosed () ) ) {
			con = gbmDBConnComp.getConnection ( vErrorObjects );
		}*/

		con = GBMDBPool.getConnection (); // Added by Prakash 11/02/2004

		//Form the Callable Statement
		sQuery = "{? = call " + sFunction + "(";
		for(iCnt=0; iCnt < (iInParamSize+iOutParamSize); iCnt++) {
			sQuery += "?,";
		}
		sQuery = sQuery.substring(0, sQuery.lastIndexOf(","));
		sQuery += ")}";

		//try - block taken above
			con.setAutoCommit(false);

			cStmt = con.prepareCall(sQuery);

			//Register the RETURNed value of the function.

			//Register Output Parameters and it will be always the first parameter to register
			cStmt.registerOutParameter(1, Types.VARCHAR);
			//System.out.println("Function is..." + sFunction);

			if (iOutParamSize > 0) {
				//System.out.println("Registering output parameters...");
				while (iCount <= iOutParamSize) {
				cStmt.registerOutParameter(iInParamSize+iCount+1, Types.VARCHAR);
				iCount++;
				}
			}

			////System.out.println("Input Parameters: " + vInParameters);

			//Set the input parameter for the callable statement
			for(iCnt=0; iCnt < iInParamSize; iCnt++) {
				////System.out.println(iCnt+1);
				//System.out.println(iCnt+1 + "-" + (String)vInParameters.get(iCnt));
				cStmt.setString(iSetCount, (String)vInParameters.get(iCnt));
				iSetCount++;
			}

			//Execute the callable statement
			if (cStmt.executeUpdate() <= 0) {
				//System.out.println("Execution failed");
				cStmt.close();
				return sResult;
			}

			//Get the Return value from the Backend Function
			sResult = cStmt.getString(1);

			iCount = 1;
			for(iCnt=0;iCnt < iOutParamSize; iCnt++) {
				vOutParameters.set(iCnt, cStmt.getString(iInParamSize+iCount+1));
				iCount++;
			}

			con.commit();
			//cStmt.close();
		} catch(SQLException eSQL) {
			//System.out.println("*******SQL EXCEPTION*******");
			try{
				con.rollback();
			}catch(SQLException eSE) {
				//System.out.println("*******SQL EXCEPTION - ROLLBACK*******");
				eSE.printStackTrace();
			}
			eSQL.printStackTrace();
			return sResult;
		}finally {

			try {
				if ( cStmt != null ) cStmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return sResult;
	}//end method executeFunction




    /**
	* To execute procedure at the database.
	* Overloaded method to accomodate array parameters
	* @param  sMapToType The type in oracle to which the array type is to be mapped
	*          sIndexArrayParam - A comma delimited string that indicates the indices of the array parameters in the vInParameters ArrayList
	* @author				:	R. Lakshmi Narasimman
	* @Date				:	31-10-2001
	* @Modification History
	* @Modified By			:
	* @Modified Date		:
	**/

	public boolean executeProcedure(GBMGeneralComponent gbmgc, String sProcedure, String sMapToType, ArrayList vInParameters, String sIndexArrayParam, ArrayList vOutParameters, ArrayList vErrorObjects) {

		String sQuery = "";
		Connection con = null; // Added by Prakash (11/02/2004)
		CallableStatement cStmt = null;

		final String DELIMITER = ",";

		int iInParamSize = 0;
		int iOutParamSize = 0;
		int iCount = 1;
		int iCnt = 0;

		if (vInParameters == null)
			return false;

		if (vInParameters.size() <= 0)
			return false;

		//Output parameter made mandatory to return error code, if any
		if (vOutParameters == null)
			return false;

		/*if (vOutParameters.size() <= 0)
			return false;*/

		iInParamSize = vInParameters.size();
		iOutParamSize = vOutParameters.size();

		if (sProcedure == null || sProcedure.trim().equals(""))
			return false;


		sIndexArrayParam = DELIMITER + sIndexArrayParam + DELIMITER;

		//Form the Callable Statement
		sQuery = "{call " + sProcedure + "(";
		for(iCnt=0; iCnt < (iInParamSize+iOutParamSize); iCnt++) {
			sQuery += "?,";
		}
		sQuery = sQuery.substring(0, sQuery.lastIndexOf(","));
		sQuery += ")}";

		//System.out.println("Procedure Name is..." + sProcedure);
		//System.out.println("Procedure :" + sQuery);
		//System.out.println("out param "+iOutParamSize);

		try{

			//createConnection(new ArrayList());
			/* Commented by Prakash 11/02/2004
			if ( ( con == null ) || ( con.isClosed () ) ) {
				con = gbmDBConnComp.getConnection ( vErrorObjects );
			}*/

			con = GBMDBPool.getConnection (); //Added by Prakash 11/02/2004

			//con.setAutoCommit(true);

			cStmt = con.prepareCall(sQuery);

			//Register Output Parameters, vDataTypes values should be like TYPES.VARCHAR, TYPES.DATE, etc
			//System.out.println("out param-------- "+iOutParamSize);
			if (iOutParamSize > 0) {
				//System.out.println("Registering output parameters...");
				while (iCount == iOutParamSize) {
					cStmt.registerOutParameter(iInParamSize+iCount, Types.VARCHAR);
					iCount++;
				}
			}

			//System.out.println("Input Parameters: " + vInParameters);

			ArrayDescriptor desc = ArrayDescriptor.createDescriptor(sMapToType.trim().toUpperCase(), con);

			//Based on types of datatype of the input parameter, set the callable statement
			for(iCnt=0;iCnt < iInParamSize; iCnt++) {

				if (sIndexArrayParam.indexOf("," + iCnt + ",") != -1) {
					ARRAY newArray = new ARRAY(desc, con, (String[])vInParameters.get(iCnt));
					((OracleCallableStatement)cStmt).setARRAY(iCnt+1, newArray);
					newArray = null;
				}
				else {
					cStmt.setString(iCnt+1, (String)vInParameters.get(iCnt));
				}
			}

			//Execute the callable statement
			if (cStmt.executeUpdate() <= 0) {
				//System.out.println("Execution failed");
				cStmt.close();
				return false;
			}

			iCount = 1;
			for(iCnt=0;iCnt < iOutParamSize; iCnt++) {
				vOutParameters.set(iCnt, cStmt.getString(iInParamSize+iCount));
				iCount++;
			}

	//			con.commit();
			//cStmt.close();

		} catch(SQLException eSQL) {
			//System.out.println("*******SQL EXCEPTION*******");
			eSQL.printStackTrace();
			try{
				con.rollback();
			}catch(SQLException eSE) {
				//System.out.println("*******SQL EXCEPTION - ROLLBACK*******");
				eSE.printStackTrace();
			}

			eSQL.printStackTrace();
			return false;
		}finally {

			try {
				if ( cStmt != null ) cStmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return true;
	}//end method executeProcedure


    /**
	 * To execute oracle function at the database.
	 * @Method Name			:	executeFunction
	 * @Purpose				:	To execute oracle function at the database
	 * @Author				:	R. Lakshmi Narasimman
	 * @Date				:	01-11-2001
	 * @Modification History
	 * @Modified By			:
	 * @Modified Date		:
     **/


	public String executeFunction(GBMGeneralComponent gbmgc, String sFunction, String sMapToType, ArrayList vInParameters, String sIndexArrayParam, ArrayList vOutParameters, ArrayList vErrorObjects) {
		String sQuery = "";
		String sResult = "NO_RESULT";
		Connection con = null; // Added by Prakash (11/02/2004)
		CallableStatement cStmt = null;

		final String DELIMITER = ",";

		int iInParamSize = 0;
		int iOutParamSize = 0;
		int iCount = 1;
		int iCnt = 0;
		int iSetCount = 2;

		if (vInParameters == null)
			return sResult;

		if (vInParameters.size() <= 0)
			return sResult;

		//Output parameter made mandatory to return error code, if any
		if (vOutParameters == null)
			return sResult;

		/*if (vOutParameters.size() <= 0)
			return false;*/

		iInParamSize = vInParameters.size();
		iOutParamSize = vOutParameters.size();

		if (sFunction == null || sFunction.trim().equals(""))
			return sResult;
		try {
		//createConnection(vErrorObjects);
		/* Commented by Prakash 11/02/2004
		if ( ( con == null ) || ( con.isClosed () ) ) {
			con = gbmDBConnComp.getConnection ( vErrorObjects );
		}*/

		con = GBMDBPool.getConnection (); // Added by Prakash 11/02/2004

		sIndexArrayParam = DELIMITER + sIndexArrayParam + DELIMITER;

		//Form the Callable Statement
		sQuery = "{? = call " + sFunction + "(";
		for(iCnt=0; iCnt < (iInParamSize+iOutParamSize); iCnt++) {
			sQuery += "?,";
		}
		sQuery = sQuery.substring(0, sQuery.lastIndexOf(","));
		sQuery += ")}";

		//try block taken above
			con.setAutoCommit(false);

			cStmt = con.prepareCall(sQuery);

			//Register the RETURNed value of the function.

			//Register Output Parameters and it will be always the first parameter to register
			cStmt.registerOutParameter(1, Types.VARCHAR);

			if (iOutParamSize > 0) {
				//System.out.println("Registering output parameters...");
				while (iCount <= iOutParamSize) {
				cStmt.registerOutParameter(iInParamSize+iCount+1, Types.VARCHAR);
				iCount++;
				}
			}

			////System.out.println("Input Parameters: " + vInParameters);

			ArrayDescriptor desc = ArrayDescriptor.createDescriptor(sMapToType.trim().toUpperCase(), con);

			//Set the input parameter for the callable statement
			for(iCnt=0; iCnt < iInParamSize; iCnt++) {
				////System.out.println(iCnt+1);
				////System.out.println((String)vInParameters.get(iCnt));

				if (sIndexArrayParam.indexOf("," + iCnt + ",") != -1) {
					ARRAY newArray = new ARRAY(desc, con, (String[])vInParameters.get(iCnt));
					((OracleCallableStatement)cStmt).setARRAY(iSetCount, newArray);
					newArray = null;
				}
				else {
					cStmt.setString(iSetCount, (String)vInParameters.get(iCnt));
				}

				iSetCount++;
			}

			//Execute the callable statement
			if (cStmt.executeUpdate() <= 0) {
				//System.out.println("Execution failed");
				cStmt.close();
				return sResult;
			}

			//Get the Return value from the Backend Function
			sResult = cStmt.getString(1);

			iCount = 1;
			for(iCnt=0;iCnt < iOutParamSize; iCnt++) {
				vOutParameters.set(iCnt, cStmt.getString(iInParamSize+iCount+1));
				iCount++;
			}

			con.commit();
			//cStmt.close();

		} catch(SQLException eSQL) {
			//System.out.println("*******SQL EXCEPTION*******");
			try{
				con.rollback();
			}catch(SQLException eSE) {
				//System.out.println("*******SQL EXCEPTION - ROLLBACK*******");
				eSE.printStackTrace();
			}

			eSQL.printStackTrace();
			return sResult;
		}finally {

			try {
				if ( cStmt != null ) cStmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}		}
		return sResult;
	}//end method executeFunction


	/**
	 * Executes the function whose return value is a reference cursor and stores the result in cursor into a HashMap and returns it
	 * @param gbmgc reference object to hold the GBMGeneralComponent
	 *        sFunction - string object to hold the function name
	 *        vInParameters - to hold the ErrorObjects
	 * @author				:	R. Lakshmi Narasimman
	 * @Date				:	20-03-2002
	 * @Modification History
	 * @Modified By			:
	 * @Modified Date		:
	 **/

	public HashMap executeFunction(GBMGeneralComponent gbmgc, String sFunction, ArrayList vInParameters, ArrayList vErrorObject) {

		HashMap htResultset = new HashMap();
		ResultSet rsValues;
		String sQuery = "";
		String sResult = "NO_RESULT";
		Connection con = null; // Added by Prakash (11/02/2004)
		CallableStatement cStmt = null;
		int iInParamSize = 0;
		int iOutParamSize = 0;
		int iCount = 1;
		int iCnt = 0;
		int iSetCount = 2;

		if (vInParameters == null)
			return htResultset;

		if (vInParameters.size() <= 0)
			return htResultset;

		iInParamSize = vInParameters.size();

		if (sFunction == null || sFunction.trim().equals(""))
			return htResultset;

		//Form the Callable Statement
		sQuery = "{? = call " + sFunction + "(";
		for(iCnt=0; iCnt < (iInParamSize); iCnt++) {
				sQuery += "?,";
		}
		sQuery = sQuery.substring(0, sQuery.lastIndexOf(","));
		sQuery += ")}";

		try{

			//createConnection(vErrorObject);
			/* Commented by Prakash 11/02/2004
			if ( ( con == null ) || ( con.isClosed () ) ) {
				con = gbmDBConnComp.getConnection ( vErrorObject );
			}*/

			con = GBMDBPool.getConnection ();  // Added by Prakash 11/02/2004
			con.setAutoCommit(false);

			cStmt = con.prepareCall(sQuery);

			//Register the RETURNed value of the function.

			//Register Output Parameters and it will be always the first parameter to register
			//This function will register the output parameter as a cursor so the function
			//should necessarily return a cursor
			cStmt.registerOutParameter(1, OracleTypes.CURSOR);

			//Set the input parameter for the callable statement
			for(iCnt=0; iCnt < iInParamSize; iCnt++) {
					////System.out.println(iCnt+1);
					////System.out.println((String)vInParameters.get(iCnt));
					cStmt.setString(iSetCount, (String)vInParameters.get(iCnt));
					iSetCount++;
			}

			//Execute the callable statement
			if (cStmt.executeUpdate() <= 0) {
					//System.out.println("Execution failed");
					cStmt.close();
					return htResultset;
			}

			iCount = 1;

			////System.out.println(cStmt.getObject(1));

			rsValues = (ResultSet)cStmt.getObject(1);

			htResultset = gbmgc.transformResultset(rsValues, vErrorObject);

			//System.out.println(htResultset.size());


			con.commit();
			//cStmt.close();
		} catch(SQLException eSQL) {
			//System.out.println("*******SQL EXCEPTION*******");
			try{
					con.rollback();
			}catch(SQLException eSE) {
					//System.out.println("*******SQL EXCEPTION - ROLLBACK*******");
					eSE.printStackTrace();
			}

			eSQL.printStackTrace();
			return htResultset;
		}finally {

			try {
				if ( cStmt != null ) cStmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return htResultset;

	}//end method executeFunction



	   /**
		* Executes an Oracle Function which returns an array containing objects as its element.
		* @param gbmgc to hold the reference object of GBMGeneralComponent
		*        sFunctionName - to hold the function name
		*        vInParam - to hold the in parameters
		*        htOutParam - to hold the output parameters
		*        htOutArrayParam - to hold the output array parameters
		*        vErrorObjects - to hold the error object
		* @return result String type data
		* @author				:	Anand V
		* @Date				:	15 June 2002
		* @Modification History
		* @Modified By			:
		* @Modified Date		:
	    **/

	public String executeArrayFunction ( GBMGeneralComponent gbmgc, String sFunctionName, ArrayList vInParam, HashMap htOutParam, HashMap htOutArrayParam, ArrayList vErrorObjects ) {

		String sQuery 	= "";
		String sResult 	= "NO_RESULT";
		String sKey		= "";
		Connection con = null; // Added by Prakash (11/02/2004)
		CallableStatement cStmt = null;
		ARRAY array;
		ResultSet rs;

		int iInParamSize 		= 0;
		int iOutParamSize 		= 0;
		int iOutArrayParamSize 	= 0;
		int iCount 				= 1;
		int iCnt 				= 0;
		int iSetCount 			= 2;
		int iArrayCnt			= 0;

		Iterator eKeys;

		iInParamSize = vInParam.size();
		iOutParamSize = htOutParam.size();
		iOutArrayParamSize = htOutArrayParam.size();

		if (sFunctionName == null || sFunctionName.trim().equals(""))
			return sResult;

		try {
		//createConnection(vErrorObjects);
		/* Commented by Prakash 11/02/2004
		if ( ( con == null ) || ( con.isClosed () ) ) {
			con = gbmDBConnComp.getConnection ( vErrorObjects );
		}*/

		con = GBMDBPool.getConnection ();  // Added by Prakash 11/02/2004

		//Form the Callable Statement
		sQuery = "{? = call " + sFunctionName + "(";
		for(iCnt=0; iCnt < (iInParamSize + iOutParamSize + iOutArrayParamSize); iCnt++) {
			sQuery += "?,";
		}
		sQuery = sQuery.substring(0, sQuery.lastIndexOf(","));
		sQuery += ")}";

		//try block starting taken above
			con.setAutoCommit(false);

			cStmt = con.prepareCall(sQuery);

			//Register the RETURNed value of the function.

			//Register Output Parameters and it will be always the first parameter to register
			cStmt.registerOutParameter(1, Types.VARCHAR);

			//Set the input parameter for the callable statement
			for (iCnt=0; iCnt < iInParamSize; iCnt++) {
				cStmt.setString(iSetCount, (String)vInParam.get(iCnt));
				iSetCount++;
			}
			Map.Entry me ;
			if (iOutParamSize > 0) {
				//System.out.println("Registering output parameters...");
				eKeys = (htOutParam.entrySet()).iterator();
				while (eKeys.hasNext()) {
					me = (Map.Entry) eKeys.next();
					sKey = (String)me.getKey();
					cStmt.registerOutParameter( Integer.parseInt(sKey) , Types.VARCHAR);
				}
			}

			if ( htOutArrayParam.size() > 0 ) {
				eKeys =(htOutArrayParam.entrySet()).iterator();

				while (eKeys.hasNext()) {
					me = (Map.Entry) eKeys.next();
					sKey = (String)me.getKey();
					cStmt.registerOutParameter( Integer.parseInt(sKey) , OracleTypes.ARRAY, (String)((ArrayList)htOutArrayParam.get(sKey)).get(0));
				}
			}

			////System.out.println("Input Parameters: " + vInParameters);

			//Execute the callable statement
			if (cStmt.executeUpdate() <= 0) {
				//System.out.println("Execution failed");
				cStmt.close();
				return sResult;
			}

			//Get the Return value from the Backend Function
			sResult = cStmt.getString(1);

			iCount = 0;

			eKeys = (htOutParam.entrySet()).iterator();

			while (eKeys.hasNext()) {
				me = (Map.Entry) eKeys.next();
				iCount = Integer.parseInt((String) me.getKey() );
				htOutParam.put(Integer.toString(iCount), cStmt.getString(iCount));
			}


			eKeys = (htOutArrayParam.entrySet()).iterator();
			ArrayList vArrayValues;
			while (eKeys.hasNext()) {
				me = (Map.Entry) eKeys.next();
				iCount = Integer.parseInt((String) me.getKey());

				vArrayValues = (ArrayList)htOutArrayParam.get(Integer.toString(iCount));
				vArrayValues.removeAll(vArrayValues);

				// Get the return value and covert it into a JDBC ResultSet
				array = (ARRAY) ((OracleCallableStatement)cStmt).getOracleObject(iCount);
				rs=array.getResultSet();

				// Loop through ResultSet rows
				while(rs.next()) {
					// 1st column is the row index
					// 2nd column is the actual object
					STRUCT obj= (STRUCT)rs.getObject(2);

					// Get the column attributes for the object
					Object[] attrs=obj.getAttributes();
					//System.out.println(attrs.length);

					// get each of the object columns
					// It is the programmers responsibility to know specifically
					// what these types are. In this case they are all strings.
					for ( iArrayCnt=0; iArrayCnt < attrs.length; iArrayCnt++ ) {
						vArrayValues.add(attrs[iArrayCnt].toString());
					}
				}

				htOutArrayParam.put(Integer.toString(iCount), vArrayValues);

				//System.out.println(htOutArrayParam);
			}


			con.commit();
			//cStmt.close();

		} catch(SQLException eSQL) {
			//System.out.println("*******SQL EXCEPTION*******");
			try{
				con.rollback();
				con.close();
			}catch(SQLException eSE) {
				//System.out.println("*******SQL EXCEPTION - ROLLBACK*******");
				eSE.printStackTrace();
			}

			eSQL.printStackTrace();
			return sResult;
		}finally {

			try {
				if ( cStmt != null ) cStmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return sResult;

	}//end method



	   /**
		* Executes the given Query using the prepared Stmt and taking the HashMap passed for the values and taking the HashMap passed for the values
		* @param  gmbgc to hold the reference of GBMGeneralComponent
		*         sQuery - to hold the string query
		*         hmValues - to hold the internal values of data
		*         vErrorObjects - to hold the error object
		* @return iRecordCount integer type data
		* @author				:	Dheepan T
		* @Date				:	30-12-2002
		* @Modification History
		* @Modified By			:
		* @Modified Date		:
        **/
	public int executeQuery(GBMGeneralComponent gbmgc, String sQuery, HashMap hmValues,ArrayList vErrorObjects){
		int iRecUpdCnt = 0;
		int iRetValue = 0;
		Connection con = null; // Added by Prakash (11/02/2004)
		PreparedStatement PrepStmt = null;

		try{
			ArrayList vValues = new ArrayList();
			String sValue = "";
			int iIndex = 0;
			Set setToHoldHashMapKeys;
			Iterator it;

			//get the connection
			/* Commented by Prakash 11/02/2004
			if ( ( con == null ) || ( con.isClosed () ) ) {
				con = gbmDBConnComp.getConnection ( vErrorObjects );
			}*/

			con = GBMDBPool.getConnection ();  // Added by Prakash 11/02/2004

			//create the prepared statement using the sQuery
			PrepStmt = con.prepareStatement(sQuery);
			//get the entryset from the hashmap
			setToHoldHashMapKeys = hmValues.entrySet();
			//create an iterator for the set
			it = setToHoldHashMapKeys.iterator();

			while(it.hasNext()){
				Map.Entry me = (Map.Entry) it.next();
				vValues = (ArrayList ) me.getValue();
				for(int j=0; j<vValues.size();j++){
					sValue = (String)vValues.get(j);
					iIndex++;
				//get the values from the ArrayList and set it to the prepared Statement
					PrepStmt.setString(iIndex,sValue);
				}
				//initialize iIndex so that the value starts from 1 for the next query
				iIndex = 0;

				iRetValue = PrepStmt.executeUpdate();

				iRecUpdCnt += iRetValue;
			}
			//System.out.println("Total Records Updated     :" + iRecUpdCnt);

			if (iRecUpdCnt == 0) {
				vErrorObjects.clear();
				gbmgc.setError("E6001015","",true,vErrorObjects);
			}
		//PrepStmt.close();

		} catch (Exception e) {
			e.printStackTrace();
			return -1;
		}finally {

			try {
				if ( PrepStmt != null ) PrepStmt.close ();

			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
			}
			try {
				if ( con != null ) con.close ();
			}catch ( SQLException sqlException){
				//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
			}
		}
		return iRecUpdCnt;
	}//end method


   /**
	* Closes the connection reference / object.
	* @Method Name			:	closeConnection
	* @Purpose				:	Closes the Connection to the database
	* @Author				:	Vasudevan G
	* @Date				:	17-08-01
	* @Modification History
	* @Modified By			:
	* @Modified Date		:
    **/

	public void closeConnection() {
	/*  Commented by Prakash (11/02/2004)
		try {
			//Close the connection
			if ( stmt != null ) stmt.close();
			if ( con != null ) con.close();
		}
		catch(Exception e) {
			//System.out.println ("inside exception - closeConnection method");
			e.printStackTrace();
		}
	*/
	}//end method

   /**
	* opens the connection reference / object and returns the same.
	* @Method Name			:	getConnection
	* @Purpose				:	Closes the Connection to the database
	* @Author				:	Vasudevan G
	* @Date				:	17-08-01
	* @Modification History
	* @Modified By			:
	* @Modified Date		:
    **/

	public Connection getConnection ( ArrayList vErrorObjects ) {
		return GBMDBPool.getConnection ();
	}//end method getConnection


	/**
	  * opens the connection reference / object and returns the same.
	 * @Purpose				:	To retrieve the time stamp from the database
	 * @Parameters			:	String sTableName, ArrayList vColumn ,
	 * @						ArrayList vValue ,ArrayList vErrorObjects
	 * @Return Value		:	Timestamp
	 * @Author				:	Nalini
	 * @Date				:	01-02-2002
	 * @Modification History
	 * @Modified By			:
	 * @Modified Date		:
	**/
		public Timestamp getTimestamp(GBMGeneralComponent gbmgc, String sTableName,ArrayList vColumn ,
	ArrayList vValue,ArrayList vErrorObjects){

		/* Declaration and initialization of variables	*/
		StringBuffer	sQuery = null;	//	To store sql statements
		Timestamp		tsDate = null;	//	To store the timestamp
		ResultSet 		rsDate = null;	//	To store records
		Connection con = null; // Added by Prakash (11/02/2004)
		Statement stmt = null; // Added by Prakash (11/02/2004)

		/* Declaration of the error code	*/
		final String SIZE_OF_COLUMNS_AND_THEIR_VALUES_DO_NOT_MATCH = "E6001072";


		try{
			/*	Obtain connection by calling createConnection method 	*/
			//createConnection(vErrorObjects);

			/*	Display error message if the number of columns and
				values are not equal	*/

			if(!(vColumn.size() == vValue.size())){

				vErrorObjects.clear();
				gbmgc.setError(SIZE_OF_COLUMNS_AND_THEIR_VALUES_DO_NOT_MATCH,"",true,vErrorObjects);

			}
			else{
				/*  Obtain the last modified date for the given table name,
					list of column and field values.If the last modified
					date is blank then get created date */

				sQuery = new StringBuffer(" SELECT NVL(last_mod_date,created_date) FROM ");
				sQuery.append(sTableName.toString() + " WHERE ");
				//System.out.println ( " >> sQuery = " + sQuery );
				//System.out.println ( " >> vColumn = " + vColumn );
				//System.out.println ( " >> vValue = " + vValue );

				for (int iCounter = 0;iCounter < vColumn.size();iCounter ++){
					if (iCounter == (vColumn.size() - 1))
						sQuery.append(vColumn.get(iCounter)+" = '" + vValue.get(iCounter) + "'");
					else
						sQuery.append(vColumn.get(iCounter)+" = '" + vValue.get(iCounter) + "' AND ");
				}

				//System.out.println("Timestamp Query " + sQuery);
				/* Commented by Prakash 11/02/2004
				if ( ( con == null ) || ( con.isClosed () ) ) {
					con = gbmDBConnComp.getConnection ( vErrorObjects );
				}*/

				con = GBMDBPool.getConnection ();  // Added by Prakash 11/02/2004
				stmt = con.createStatement ();
				//System.out.println (" >>>> stmt = " + stmt );
				rsDate = stmt.executeQuery( sQuery.toString() );

				/*	Store the result of execution of query in time stamp object	*/
				while( rsDate.next() ) {
					tsDate = rsDate.getTimestamp(1);
					//System.out.println (" inside loop ");
				}
				//rsDate.close();
				//System.out.println("Date ******" + tsDate);
				//stmt.close();
			}
		}
		catch(Exception e){
			gbmgc.createErrorLog(e);
			e.printStackTrace();
		}finally {

				try {
					if (rsDate != null ) rsDate.close();
				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method -rs.close() method in finally block  ");
				}
				try {
					if ( stmt != null ) stmt.close ();

				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
				}
				try {
					if ( con != null ) con.close ();
				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
				}
		}
		return tsDate;
	}//end method getTimestamp


		/****************************************************************
			@Method Name			:	getRecordSet
			@Purpose				:	Gives the recordset in a ArrayList containing HashMap for each row. Column name is the key in the HashMap.
			@Parameters			:	String sQuery, ArrayList vErrorObjects
			@Return Value		:	ArrayList
			@Author				:	Damodara Reddy A
			@Date				:	25 June 2002
			@Modification History
			@Modified By			:
			@Modified Date		:
		*****************************************************************/

	    public ArrayList getRecordSet ( GBMGeneralComponent gbmgc, String sQuery, ArrayList vErrorObjects) throws SQLException {

			ResultSet rs = null;
			ResultSetMetaData rsmd = null;
			Connection con = null; // Added by Prakash (11/02/2004)
			Statement stmt = null; // Added by Prakash (11/02/2004)

			ArrayList vRecords = new ArrayList ();

			HashMap hRecords;
			String sValue;

			boolean bIsRecords = false;
			try{
				//createConnection(vErrorObjects);
				//System.out.println( "Query " + sQuery );
				/* Commented by Prakash 11/02/2004
				if ( ( con == null ) || ( con.isClosed () ) ) {
					con = gbmDBConnComp.getConnection ( vErrorObjects );
				}*/

				con = GBMDBPool.getConnection ();  // Added by Prakash 11/02/2004
				stmt = con.createStatement () ;
				rs = stmt.executeQuery ( sQuery );
				rsmd = rs.getMetaData ();
				int iColumnCount = rsmd.getColumnCount ();
				bIsRecords = rs.next ();
				if( bIsRecords ) {
					do {
						hRecords = new HashMap ();
						for( int iCnt = 0 ; iCnt < iColumnCount ; iCnt++ ){
							sValue = rs.getString ( iCnt+1 );
							if( sValue != null ) {
								sValue = sValue.trim ();
							}
							hRecords.put ( rsmd.getColumnName ( iCnt+1 ) , sValue );
						}
						vRecords.add ( hRecords );
					} while( rs.next () );
				}
				//rs.close ();
				//stmt.close();
			}finally {
				try {
					if (rs != null ) rs.close();
				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method -rs.close() method in finally block  ");
				}
				try {
					if ( stmt != null ) stmt.close ();

				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method - stmt.close ()in finally block ");
				}
				try {
					if ( con != null ) con.close ();
				}catch ( SQLException sqlException){
					//System.out.println ( ">> Inside exception getResultSet0 Method -con.close () in finally block ");
				}
			}//end finally block
			return (ArrayList)vRecords.clone ();
    }//end method getRecordSet

private long getCurrentTime (){
	return ( new java.util.Date ().getTime () ) ;
}//end method

/*	Method commented by vidya.k on 13.05.2005 to improve performance
private void printTimeDifferences( long lStartTime, long lEndTime ){
	//System.out.println (" >>> lStartTime = " + lStartTime + " >>>> lEndTime = " + lEndTime + " >>>> Difference = " + (double) ( lEndTime - lStartTime ) /1000 );
}//end method	*/

}//end class GBMDBCommonComponent
