Merge pull request #1859 from selvaganesang/t2_driver_cleanup_1

[TRAFODION-3329] Code cleanup in Type 2 driver
diff --git a/core/conn/jdbc_type2/native/CSrvrConnect.cpp b/core/conn/jdbc_type2/native/CSrvrConnect.cpp
index 779775c..a0a63e9 100644
--- a/core/conn/jdbc_type2/native/CSrvrConnect.cpp
+++ b/core/conn/jdbc_type2/native/CSrvrConnect.cpp
@@ -308,14 +308,6 @@
                 free32(tempPtr);
             }
 #endif
-            // Remove the Module from the list: This is MFC Code.
-            if(lpSrvrStmt->moduleId.module_name != NULL)
-            {
-                // This is safe even if the Module is not an MFC Module.
-                // Because if these are canned queries, this will not
-                // be in the MFC set.
-                this->removeFromLoadedModuleSet((const char *)lpSrvrStmt->moduleId.module_name);
-            }
             // If the statement being deleted is current statement, reset the current statement
             if (pCurrentSrvrStmt == lpSrvrStmt)
             {
@@ -491,74 +483,6 @@
     }
 }
 
-SRVR_STMT_HDL *SRVR_CONNECT_HDL::createSrvrStmtForMFC(
-    const char *stmtLabel,
-    long    *sqlcode,
-    const char *moduleName,
-    long moduleVersion,
-    long long moduleTimestamp,
-    short   sqlStmtType,
-    BOOL    useDefaultDesc)
-{
-    FUNCTION_ENTRY("SRVR_CONNECT_HDL::createSrvrStmt",("..."));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  stmtLabel=%s, sqlcode=0x%08x",
-        DebugString(stmtLabel),
-        sqlcode));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  moduleName=%s",
-        DebugString(moduleName)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  moduleVersion=%ld, moduleTimestamp=%s",
-        moduleVersion,
-        DebugTimestampStr(moduleTimestamp)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  sqlStmtType=%s, useDefaultDesc=%d",
-        CliDebugSqlStatementType(sqlStmtType),
-        useDefaultDesc));
-
-    SQLRETURN rc;
-    SRVR_STMT_HDL *pSrvrStmt;
-    int retcode;
-
-    pSrvrStmt = NULL;//getSrvrStmt(stmtLabel, sqlcode, moduleName);
-        MEMORY_ALLOC_OBJ(pSrvrStmt,SRVR_STMT_HDL((long)this));
-
-        rc = pSrvrStmt->allocSqlmxHdls(stmtLabel, moduleName, moduleTimestamp,
-            moduleVersion, sqlStmtType, useDefaultDesc);
-        if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
-        {
-            MEMORY_DELETE_OBJ(pSrvrStmt);
-        if (sqlcode)
-            *sqlcode = rc;
-        FUNCTION_RETURN_PTR(NULL,
-                ("pSrvrStmt->allocSqlmxHdls returned %s",CliDebugSqlError(rc)));
-        }
-        addSrvrStmt(pSrvrStmt);
-
-    if (sqlcode)
-        *sqlcode = SQL_SUCCESS;
-    FUNCTION_RETURN_PTR(pSrvrStmt,(NULL));
-}
-
-//MFC
-void SRVR_CONNECT_HDL::referenceCountForModuleLoaded(std::string strModuleName)
-{
-    if(!this->isModuleLoaded(strModuleName))
-    {
-        this->setOfLoadedModules.insert(strModuleName);
-    }
-}
-//MFC
-bool SRVR_CONNECT_HDL::isModuleLoaded(std::string strModuleName)
-{
-    return this->setOfLoadedModules.find(strModuleName) != this->setOfLoadedModules.end();
-}
-// MFC
-void SRVR_CONNECT_HDL::removeFromLoadedModuleSet(std::string strModuleName)
-{
-    if(this->isModuleLoaded(strModuleName))
-    {
-        this->setOfLoadedModules.erase(strModuleName);
-    }
-}
-
 // +++ T2_REPO
 void sendSessionEnd(std::tr1::shared_ptr<SESSION_END> pSession_info)
 {
diff --git a/core/conn/jdbc_type2/native/CSrvrConnect.h b/core/conn/jdbc_type2/native/CSrvrConnect.h
index e25069e..658df26 100644
--- a/core/conn/jdbc_type2/native/CSrvrConnect.h
+++ b/core/conn/jdbc_type2/native/CSrvrConnect.h
@@ -77,13 +77,6 @@
 		Int32  resultSetIndex = 0,
 		SQLSTMT_ID* callStmtId = NULL);
 
-	SRVR_STMT_HDL *createSrvrStmtForMFC(const char *stmtLabel,
-		long	*sqlcode,
-		const char *moduleName,
-		long moduleVersion,
-		long long moduleTimestamp,
-		short	sqlStmtType,
-		BOOL	useDefaultDesc);
 	SRVR_STMT_HDL *createSpjrsSrvrStmt(SRVR_STMT_HDL *pSrvrStmt,
 		const char *stmtLabel,
 		long	*sqlcode,
@@ -105,9 +98,6 @@
 	}
 	
 	inline void setCurrentStmt(SRVR_STMT_HDL *pSrvrStmt) { pCurrentSrvrStmt = pSrvrStmt;};
-	bool isModuleLoaded(std::string strModuleName);//MFC
-	void removeFromLoadedModuleSet(std::string strModuleName);//MFC
-	void referenceCountForModuleLoaded(std::string strModuleName);//MFC
 public:
 	SQLCTX_HANDLE			contextHandle;
 	ERROR_DESC_LIST_def		sqlWarning;
@@ -120,13 +110,11 @@
 	char				CurrentCatalog[129];
 	char				CurrentSchema[129];
 	
-	std::list<std::string> listOfCQDs;
-
 private:
 	SRVR_STMT_HDL_LIST		*pSrvrStmtListHead;
 	
-    MapOfSrvrStmt mapOfSrvrStmt;
-    MapOfInternalSrvrStmt mapOfInternalSrvrStmt;
+	MapOfSrvrStmt mapOfSrvrStmt;
+	MapOfInternalSrvrStmt mapOfInternalSrvrStmt;
 
 	SRVR_STMT_HDL			*pCurrentSrvrStmt;
 	long					count;
diff --git a/core/conn/jdbc_type2/native/CSrvrStmt.cpp b/core/conn/jdbc_type2/native/CSrvrStmt.cpp
index cba70b6..8d1b6e0 100644
--- a/core/conn/jdbc_type2/native/CSrvrStmt.cpp
+++ b/core/conn/jdbc_type2/native/CSrvrStmt.cpp
@@ -95,7 +95,6 @@
     clientLCID = srvrGlobal->clientLCID;
     rowCount._length = 0;
     rowCount._buffer = NULL;
-    isReadFromModule = FALSE;
     moduleName[0] = '\0';
     inputDescName[0] = '\0';
     outputDescName[0] = '\0';
@@ -156,21 +155,18 @@
 }
 
 SQLRETURN SRVR_STMT_HDL::Prepare(const SQLValue_def *inSqlString, short inStmtType, short inHoldability,
-                                 long inQueryTimeout,bool isISUD)
+                                 long inQueryTimeout)
 {
     FUNCTION_ENTRY("SRVR_STMT_HDL::Prepare",(""));
     DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inSqlString='%s'",
         CLI_SQL_VALUE_STR(inSqlString)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inStmtType=%s, inHoldability=%d, inQueryTimeout=%ld, isISUD=%d",
+    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inStmtType=%s, inHoldability=%d, inQueryTimeout=%ld",
         CliDebugStatementType(inStmtType),
         inHoldability,
-        inQueryTimeout,isISUD));
+        inQueryTimeout));
 
     SQLRETURN rc;
     size_t  len;
-    this->isISUD = isISUD;
-    if (isReadFromModule)   // Already SMD label is found
-        CLI_DEBUG_RETURN_SQL(SQL_SUCCESS);
     // cleanup all memory allocated in the previous operations
     cleanupAll();
     sqlString.dataCharset = inSqlString->dataCharset;
@@ -265,54 +261,6 @@
     case SQL_SUCCESS_WITH_INFO:
         outValueList->_buffer = outputValueList._buffer;
         outValueList->_length = outputValueList._length;
-        //MFC update srvrGlobal if any CQD/catalog/schema is set
-        if (this->sqlString.dataValue._buffer != NULL)
-        {
-            if (this->SqlQueryStatementType == 9) // CQD is being set here
-            {
-                // The CQDs which are considered for creating HASH
-                // name of the Module File. Right now this conisders
-                // only the CQDs set by the JDBC/MX T2 Driver.
-                //Modified for sol 10-100618-1193
-                //srvrGlobal->setOfCQD.insert(this->sqlString.dataValue._buffer);
-                ((SRVR_CONNECT_HDL *)dialogueId)->listOfCQDs.push_back((const char *)this->sqlString.dataValue._buffer);
-            }
-            if (this->SqlQueryStatementType == 11) // set catalog
-            {
-                char currentSqlString[100];
-                strcpy(currentSqlString,(const char *)this->sqlString.dataValue._buffer);
-                strToUpper(currentSqlString);
-                char *stringtoken = strtok_r(currentSqlString," ",&saveptr);
-                stringtoken = strtok_r(NULL," ",&saveptr);
-                stringtoken = strtok_r(NULL," ;'",&saveptr);
-                strcpy(pConnect->CurrentCatalog,(stringtoken));
-            }
-            if(this->SqlQueryStatementType == 12) // set schema
-            {
-                char currentSqlString1[100],currentSqlString2[100];
-                strcpy(currentSqlString1,(const char *)this->sqlString.dataValue._buffer);
-                strToUpper(currentSqlString1);
-
-                saveptr=NULL;
-                char *stringtoken = strtok_r(currentSqlString1," ",&saveptr);
-                stringtoken = strtok_r(NULL," ",&saveptr);
-                stringtoken = strtok_r(NULL," ;\n\t",&saveptr);
-                strcpy(currentSqlString2,stringtoken);
-
-                int pos = strcspn(stringtoken,".");
-                if (pos == strlen(stringtoken))
-                    strcpy(pConnect->CurrentSchema,(stringtoken));
-                else
-                {
-                    saveptr=NULL;
-                    stringtoken = strtok_r(currentSqlString2,".",&saveptr);
-                    strcpy(pConnect->CurrentCatalog,(stringtoken));
-                    stringtoken = strtok_r(NULL,"; \t\n",&saveptr);
-                    strcpy(pConnect->CurrentSchema,(stringtoken));
-                }
-            }
-        }
-        //MFC update srvrGlobal end
         break;
     case ODBC_SERVER_ERROR:
         // Allocate Error Desc
@@ -535,37 +483,6 @@
     FUNCTION_RETURN_VOID((NULL));
 }
 
-SQLRETURN SRVR_STMT_HDL::PrepareFromModule(short inStmtType)
-{
-    FUNCTION_ENTRY("SRVR_STMT_HDL::PrepareFromModule",("inStmtType=%s",
-        CliDebugStatementType(inStmtType)));
-
-    SQLRETURN rc;
-    size_t  len;
-    if (srvrGlobal->moduleCaching)
-    {
-        if (!this->isClosed)
-        {
-            long retcode = SQL_SUCCESS;
-            SQLSTMT_ID  *pStmt = &(this->stmt);
-            retcode = CLI_CloseStmt(pStmt);
-
-            if (retcode!=0) retcode = CLI_ClearDiagnostics(pStmt);
-            this->isClosed = TRUE;
-        }
-    }
-
-    if (isReadFromModule) CLI_DEBUG_RETURN_SQL(SQL_SUCCESS);
-    // cleanup all memory allocated in the previous operations
-    cleanupAll();
-    stmtType = inStmtType;
-    estimatedCost = -1;
-    rc = PREPARE_FROM_MODULE(this);
-    if (rc != SQL_ERROR)
-        isReadFromModule = TRUE;
-    CLI_DEBUG_RETURN_SQL(rc);
-}
-
 SQLRETURN SRVR_STMT_HDL::freeBuffers(short descType)
 {
     FUNCTION_ENTRY("SRVR_STMT_HDL::freeBuffers",("descType=%d",
@@ -657,23 +574,11 @@
 
     strcpy(stmtName, inStmtName);
     stmtNameLen = strlen(inStmtName);
-    if (inModuleName != NULL)
-    {
-        moduleId.version = inModuleVersion;
-        strcpy(moduleName, inModuleName);
-        moduleId.module_name = moduleName;
-        moduleId.module_name_len = strlen(moduleName);
-        moduleId.charset = "ISO88591";
-        moduleId.creation_timestamp = inModuleTimestamp;
-    }
-    else
-    {
-        moduleId.version = SQLCLI_ODBC_MODULE_VERSION;
-        moduleId.module_name = NULL;
-        moduleId.module_name_len = 0;
-        moduleId.charset = "ISO88591";
-        moduleId.creation_timestamp = 0;
-    }
+    moduleId.version = SQLCLI_ODBC_MODULE_VERSION;
+    moduleId.module_name = NULL;
+    moduleId.module_name_len = 0;
+    moduleId.charset = "ISO88591";
+    moduleId.creation_timestamp = 0;
     sqlStmtType = inSqlStmtType;
     useDefaultDesc = inUseDefaultDesc;
     rc = ALLOCSQLMXHDLS(this);
@@ -1103,52 +1008,3 @@
     }
     FUNCTION_RETURN_PTR(NULL,("Unknown"));
 }
-//MFC
-// MFC
-SQLRETURN SRVR_STMT_HDL::PrepareforMFC(const SQLValue_def *inSqlString, short inStmtType, short inHoldability,
-                                       long inQueryTimeout,bool isISUD)
-{
-    FUNCTION_ENTRY("SRVR_STMT_HDL::PrepareforMFC",(""));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inSqlString='%s'",
-        CLI_SQL_VALUE_STR(inSqlString)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  inStmtType=%s, inHoldability=%d, inQueryTimeout=%ld, isISUD=%d",
-        CliDebugStatementType(inStmtType),
-        inHoldability,
-        inQueryTimeout,isISUD));
-
-    SQLRETURN rc;
-    size_t  len;
-    this->isISUD = isISUD;
-    if (srvrGlobal->moduleCaching)
-    {
-        if (!this->isClosed)
-        {
-            long retcode = SQL_SUCCESS;
-            SQLSTMT_ID  *pStmt = &(this->stmt);
-            retcode = CLI_CloseStmt(pStmt);
-
-            if (retcode!=0)
-            {
-                retcode = CLI_ClearDiagnostics(pStmt);
-            }
-            this->isClosed = TRUE;
-        }
-    }
-    if (isReadFromModule)   // Already SMD label is found
-    {
-        CLI_DEBUG_RETURN_SQL(SQL_SUCCESS);
-    }
-    // cleanup all memory allocated in the previous operations
-    cleanupAll();
-    sqlString.dataCharset = inSqlString->dataCharset;
-    sqlString.dataType = inSqlString->dataType;
-    MEMORY_ALLOC_ARRAY(sqlString.dataValue._buffer,unsigned char,inSqlString->dataValue._length+1);
-    sqlString.dataValue._length = inSqlString->dataValue._length+1;
-
-    strncpy((char *)sqlString.dataValue._buffer, (const char *)inSqlString->dataValue._buffer, inSqlString->dataValue._length);
-    sqlString.dataValue._buffer[inSqlString->dataValue._length] = '\0';
-    stmtType = inStmtType;
-    holdability = inHoldability;
-
-    CLI_DEBUG_RETURN_SQL(PREPAREFORMFC(this));
-}
diff --git a/core/conn/jdbc_type2/native/CSrvrStmt.h b/core/conn/jdbc_type2/native/CSrvrStmt.h
index d57179d..f0aa3eb 100644
--- a/core/conn/jdbc_type2/native/CSrvrStmt.h
+++ b/core/conn/jdbc_type2/native/CSrvrStmt.h
@@ -41,8 +41,6 @@
 
 //#include "spthread.h" commented by venu for TSLX
 #define     UNKNOWN_METHOD          -1
-#define     Prepare_From_Module     20  // PrepareFromModule Method Operation Index
-// addition to SrvrOthers.h indexes, which stop at 19
 #define     MAX_RESULT_SETS         255 // Max number of RS per stmt
 
 
@@ -65,7 +63,6 @@
     BYTE                    *outputDescVarBuffer;       // Data Buffer for output values
     long                    inputDescVarBufferLen;
     long                    outputDescVarBufferLen;
-    BOOL                    isReadFromModule;
     jobject                 resultSetObject;
     BOOL                    endOfData;
     BOOL                    isSPJRS;                        // RS Query Stmt Type (e.g. SQL_CALL_NO_RESULT_SETS, SQL_CALL_WITH_RESULT_SETS)
@@ -191,9 +188,7 @@
     SRVR_STMT_HDL(long dialogueId);
     ~SRVR_STMT_HDL();
     //SRVR_STMT_HDL(const char *inStmtLabel, const char *moduleName);
-    SQLRETURN Prepare(const SQLValue_def *inSqlString, short inStmtType, short holdability, long inQueryTimeout,bool isISUD = FALSE);
-    // MFC
-    SQLRETURN PrepareforMFC(const SQLValue_def *inSqlString, short inStmtType, short holdability, long inQueryTimeout, bool isISUD = FALSE);
+    SQLRETURN Prepare(const SQLValue_def *inSqlString, short inStmtType, short holdability, long inQueryTimeout);
     SQLRETURN Execute(const char *inCursorName, long inputRowcnt, short sqlStmtType,
         const SQLValueList_def *inputValueList,short inSqlAsyncEnable, long inQueryTimeout,
         SQLValueList_def *outputValueList);
@@ -207,7 +202,6 @@
     void cleanupSQLValueList();
     void cleanupSQLDescList();
     void cleanupAll();
-    SQLRETURN PrepareFromModule(short stmtType);
     SQLRETURN InternalStmtClose(unsigned short inFreeResourceOpt);
     SQLRETURN freeBuffers(short descType);
     void processThreadReturnCode(void);
diff --git a/core/conn/jdbc_type2/native/CoreCommon.h b/core/conn/jdbc_type2/native/CoreCommon.h
index c131173..7fb166c 100644
--- a/core/conn/jdbc_type2/native/CoreCommon.h
+++ b/core/conn/jdbc_type2/native/CoreCommon.h
@@ -278,7 +278,7 @@
 #define SQLSVC_EXCEPTION_CATSMD_MODULE_ERROR "The Catalog SMD file is either corrupted or not found or cursor not found"
 #define SQLSVC_EXCEPTION_BUFFER_ALLOC_FAILED "Buffer Allocation Failed"
 #define SQLSVC_EXCEPTION_INVALID_HANDLE "Error while allocating Handles in SQL/MX"
-#define SQLSVC_EXCEPTION_READING_FROM_MODULE_FAILED "Reading From Module failed or Module Corrupted or Module not found"
+#define SQLSVC_EXCEPTION_PREPARE_FAILED "Error while preparing the query"
 #define SQLSVC_EXCEPTION_NOWAIT_ERROR   "Error in thread synchronizing functions - Vendor code is FS Error"
 #define SQLSVC_EXCEPTION_INVALID_SCHEMA_VERSION "Invalid Schema version"  // Used for Metadata schemaVersion setup
 
@@ -381,10 +381,6 @@
     char                DefaultSchema[129];
     char                CurrentCatalog[129]; // Added for MFC
     char                CurrentSchema[129];  // Added for MFC
-    //moved setOfCQD to CsrvrConnect.h sol. Sol. 10-100618-1194
-//  std::set<std::string> setOfCQD; // Added for MFC
-    int                 moduleCaching;          // Added for MFC
-    char                compiledModuleLocation[100]; // Added for MFC
     bool                jdbcProcess;        // This flag is used to determine the query for SQLTables
     short               nowaitOn;
     short               nowaitFilenum;
diff --git a/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp b/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp
index 9373fa1..31b556d 100644
--- a/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp
@@ -134,9 +134,7 @@
 		&outputDesc,
 		&sqlWarning,
 		&stmtId,
-		&inputParamOffset,
-		NULL, // MFC
-		false);
+		&inputParamOffset);
 
 	if (sql)
 	{
@@ -293,116 +291,3 @@
 	}
 	FUNCTION_RETURN_VOID((NULL));
 }
-
-JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXCallableStatement_cpqPrepareCall
-(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId,
- jint txid, jboolean autoCommit, jint txnMode,
- jstring moduleName, jint moduleVersion, jlong moduleTimestamp, jstring stmtName,
- jint queryTimeout, jint holdability, jint fetchSize)
-{
-	FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_SQLMXCallableStatement_cpqPrepareCall",("..."));
-
-	long							estimatedCost;
-	long							inputParamOffset;
-	ERROR_DESC_LIST_def				sqlWarning;
-	SQLItemDescList_def				outputDesc;
-	SQLItemDescList_def				inputDesc;
-	jint							currentTxid = txid;
-	jint							externalTxid = 0;
-	long							stmtId;
-	const char						*nModuleName = NULL;
-	const char						*nStmtName = NULL;
-	short							txn_status;
-
-	ExceptionStruct	exception_;
-	CLEAR_EXCEPTION(exception_);
-
-	if (moduleName)
-		nModuleName = JNI_GetStringUTFChars(jenv,moduleName, NULL);
-	else
-	{
-		throwSQLException(jenv, INVALID_MODULE_NAME_ERROR, NULL, "HY000");
-		FUNCTION_RETURN_VOID(("moduleName is Null"));
-	}
-
-	if (stmtName)
-		nStmtName = JNI_GetStringUTFChars(jenv,stmtName, NULL);
-	else
-	{
-		throwSQLException(jenv, INVALID_STMT_LABEL_ERROR, NULL, "HY000");
-		FUNCTION_RETURN_VOID(("stmtName is Null"));
-	}
-
-	if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1)) != 0)
-	{
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwTransactionException(jenv, txn_status);
-		FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
-	}
-
-	odbc_SQLSvc_PrepareFromModule_sme_(NULL, NULL,
-		&exception_,
-		dialogueId,
-		(char *)nModuleName,
-		moduleVersion,
-		moduleTimestamp,
-		(char *)nStmtName,
-		TYPE_CALL,
-		fetchSize,
-		0,
-		0,
-		&estimatedCost,
-		&inputDesc,
-		&outputDesc,
-		&sqlWarning,
-		&stmtId,
-		&inputParamOffset);
-
-	if (moduleName)
-		JNI_ReleaseStringUTFChars(jenv,moduleName, nModuleName);
-
-	if (stmtName)
-		JNI_ReleaseStringUTFChars(jenv,stmtName, nStmtName);
-
-	// Prepare, don't abort transaction even if there is an error, hence CEE_SUCCESS
-	if ((txn_status = endTxnControl(jenv, currentTxid, txid,
-		autoCommit, CEE_SUCCESS, FALSE, txnMode, externalTxid)) != 0)
-	{
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwTransactionException(jenv, txn_status);
-		FUNCTION_RETURN_VOID(("endTxnControl() Failed"));
-	}
-
-	switch (exception_.exception_nr)
-	{
-	case CEE_SUCCESS:
-		outputDesc._length = 0;
-		outputDesc._buffer = 0;
-		setPrepareOutputs(jenv, jobj, &inputDesc, &outputDesc, currentTxid, stmtId, inputParamOffset);
-		if (sqlWarning._length > 0)
-			setSQLWarning(jenv, jobj, &sqlWarning);
-		break;
-	case odbc_SQLSvc_PrepareFromModule_SQLQueryCancelled_exn_:
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
-			exception_.u.SQLQueryCancelled.sqlcode);
-		break;
-	case odbc_SQLSvc_PrepareFromModule_SQLError_exn_:
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, &exception_.u.SQLError);
-		break;
-	case odbc_SQLSvc_PrepareFromModule_ParamError_exn_:
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, MODULE_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
-		break;
-	case odbc_SQLSvc_PrepareFromModule_SQLStillExecuting_exn_:
-	case odbc_SQLSvc_PrepareFromModule_InvalidConnection_exn_:
-	case odbc_SQLSvc_PrepareFromModule_TransactionError_exn_:
-	default:
-		// TFDS - These exceptions should not happen
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
-		break;
-	}
-	FUNCTION_RETURN_VOID((NULL));
-}
diff --git a/core/conn/jdbc_type2/native/SQLMXConnection.cpp b/core/conn/jdbc_type2/native/SQLMXConnection.cpp
index 11758d4..c564658 100644
--- a/core/conn/jdbc_type2/native/SQLMXConnection.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXConnection.cpp
@@ -381,7 +381,7 @@
 JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connectInit
 (JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId, jstring catalog,
         jstring schema, jstring mploc, jboolean isReadOnly, jboolean autoCommit, jint transactionIsolation,
-        jint loginTimeout, jint queryTimeout, jstring modulecaching, jstring compiledmodulelocation, jboolean blnDoomUsrTxn,
+        jint loginTimeout, jint queryTimeout, jboolean blnDoomUsrTxn,
         jint statisticsIntervalTime, jint statisticsLimitTime, jstring statisticsType, jstring programStatisticsEnabled, jstring statisticsSqlPlanEnabled)
 {
 
@@ -410,21 +410,11 @@
                     DebugJString(jenv,statisticsSqlPlanEnabled)
             ));
 
-    //MFC - new properties
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  MFC modulecaching=%s",
-                    DebugJString(jenv,modulecaching)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  MFC compiledmodulelocation=%s",
-                    DebugJString(jenv,compiledmodulelocation)));
-
     const char *nCatalog;
     const char *nSchema;
     const char *nMploc;
     jthrowable exception;
 
-    // MFC - new properties
-    const char *nModuleCaching;
-    const char *nCompiledModuleLocation;
-
     // PUBLISHING
     const char *nStatisticsType;
     const char *nProgramStatisticsEnabled;
@@ -670,40 +660,6 @@
         FUNCTION_RETURN_VOID(("SQL_AUTOCOMMIT - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
                         CliDebugSqlError(setConnectException.exception_nr)));
     }
-    // MFC if mfc is on set the recompilation warnings on
-    // to help remove stale modules
-    if (srvrGlobal->moduleCaching == 1)
-    {
-        odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
-                &setConnectException,
-                dialogueId,
-                SQL_RECOMPILE_WARNING,
-                0,
-                NULL,
-                &sqlWarning
-        );
-
-        if (setConnectException.exception_nr != CEE_SUCCESS)
-        {
-            throwSetConnectionException(jenv, &setConnectException);
-            FUNCTION_RETURN_VOID(("SQL_RECOMPILE_WARNING - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                            CliDebugSqlError(setConnectException.exception_nr)));
-        }
-        //MFC support for BigNum
-        odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,&setConnectException,dialogueId,
-                SET_SESSION_INTERNAL_IO,0,NULL,
-                &sqlWarning);
-
-        if (setConnectException.exception_nr != CEE_SUCCESS)
-
-        {
-            throwSetConnectionException(jenv, &setConnectException);
-            FUNCTION_RETURN_VOID(("Set Session internal_format_io failure setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                            CliDebugSqlError(setConnectException.exception_nr)));
-
-        }
-
-    }
 
 //    printf("Native statisticsIntervalTime :%ld\n", statisticsIntervalTime);
 //    printf("Native statisticsLimitTime :%ld\n", statisticsLimitTime);
@@ -1150,18 +1106,3 @@
     }
     FUNCTION_RETURN_VOID((NULL));
 }
-
-//Sol. 10-100618-1186
-/*
- * Class:     org_apache_trafodion_jdbc_t2_SQLMXConnection
- * Method:    clearSetOfCQDs
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_clearSetOfCQDs
-(JNIEnv *jenv, jobject obj, jlong dialogueId)
-{
-    FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_clearSetOfCQDs",("..."));
-//cleare CQD's upon a logical connection close.
-    ((SRVR_CONNECT_HDL*)dialogueId)->listOfCQDs.clear();
-    FUNCTION_RETURN_VOID((NULL));
-}
diff --git a/core/conn/jdbc_type2/native/SQLMXDriver.cpp b/core/conn/jdbc_type2/native/SQLMXDriver.cpp
index 0f2a3e8..e7a0fba 100644
--- a/core/conn/jdbc_type2/native/SQLMXDriver.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXDriver.cpp
@@ -75,18 +75,14 @@
 * Method:    SQLMXInitialize
 * Signature: (Ljava/lang/String;I)V
 */
-// MFC - added two parameters to set the MFC on/off and the directory
 JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitialize(JNIEnv *jenv, jclass cls,
-																		 jstring language, jint nowaitOn, jstring moduleCaching, jstring compiledModuleLocation)
+																		 jstring language, jint nowaitOn)
 {
 	FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitialize",("language=%s, nowaitOn=%ld",
 		DebugJString(jenv,language),
 		nowaitOn));
 	const char 					*nLanguage;
 	//	static GlobalInformation	*globalInfo = new GlobalInformation();
-	//MFC
-	const char					*nModuleCaching;
-	const char					*nCompiledModuleLocation;
         
 	if (!driverVersionChecked)
 	{
@@ -174,63 +170,7 @@
 		FUNCTION_RETURN_VOID(("envGetMXSystemCatalogName() failed"));
 	}
 #endif
-
-	// MFC - set the srvrGlobal variables w.r.t the properties - start
-
-	srvrGlobal->moduleCaching=0;
-	if (moduleCaching)
-	{
-		nModuleCaching = JNI_GetStringUTFChars(jenv,moduleCaching, NULL);
-		if (strcmp(nModuleCaching,"ON") == 0)
-			srvrGlobal->moduleCaching=1;
-
-		//Soln. No.: 10-110927-9875 - fix memory leak
-		JNI_ReleaseStringUTFChars(jenv,moduleCaching, nModuleCaching);
-	}
-
-
-	if (srvrGlobal->moduleCaching == 1)
-	{
-		memset(srvrGlobal->CurrentCatalog, '\0', 129);
-		memset(srvrGlobal->CurrentSchema, '\0', 129);
-		memset(srvrGlobal->compiledModuleLocation, '\0', 100);
-		if (compiledModuleLocation == NULL)
-		{
-			strcpy(srvrGlobal->compiledModuleLocation,"/usr/tandem/sqlmx/USERMODULES");
-		}
-		else
-		{
-			nCompiledModuleLocation = JNI_GetStringUTFChars(jenv,compiledModuleLocation, NULL);
-			strcpy(srvrGlobal->compiledModuleLocation,nCompiledModuleLocation);
-
-			//Soln. No.: 10-110927-9875 - fix memory leak
-			JNI_ReleaseStringUTFChars(jenv,compiledModuleLocation, nCompiledModuleLocation);
-
-			if(srvrGlobal->compiledModuleLocation[0] != '/')
-			{
-				printf("The directory provided for option \"compiledmodulelocation\" must be an absolute path.\n");
-				abort();
-			}
-			int nDirExists = access(srvrGlobal->compiledModuleLocation, F_OK);
-			if(nDirExists != 0)
-			{
-				printf("The directory provided for option \"compiledmodulelocation\" does not exist.\n");
-				abort();
-			}
-			nDirExists = access(srvrGlobal->compiledModuleLocation, W_OK);
-			if(nDirExists != 0)
-			{
-				printf("The directory provided for option \"compiledmodulelocation\" does not have \"write\" permission.\n");
-				abort();
-			}
-			if(srvrGlobal->compiledModuleLocation[strlen(srvrGlobal->compiledModuleLocation)-1] == '/')
-			{
-				srvrGlobal->compiledModuleLocation[strlen(srvrGlobal->compiledModuleLocation)-1] = '\0';
-			}
-		}
-	}
 	srvrGlobal->boolFlgforInitialization = 1;
-	// MFC set the srvrGlobal variables w.r.t the properties - end
 	FUNCTION_RETURN_VOID((NULL));
 }
 
diff --git a/core/conn/jdbc_type2/native/SQLMXPreparedStatement.cpp b/core/conn/jdbc_type2/native/SQLMXPreparedStatement.cpp
index 568239e..503c4a4 100644
--- a/core/conn/jdbc_type2/native/SQLMXPreparedStatement.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXPreparedStatement.cpp
@@ -25,13 +25,7 @@
 //
 
 #include <platform_ndcs.h>
-#ifdef NSK_PLATFORM
-#include <sqlWin.h>
-#include <windows.h>
-#include <MD5.h>  // MFC
-#else
 #include <sql.h>
-#endif
 #include <sqlext.h>
 #include "CoreCommon.h"
 #include "JdbcDriverGlobal.h"
@@ -42,8 +36,6 @@
 #include "SrvrCommon.h"
 #endif
 #include "Debug.h"
-#include <sys/types.h>//MFC
-#include<sys/stat.h>// MFC
 
 
 JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXPreparedStatement_prepare
@@ -138,9 +130,7 @@
 		&outputDesc,
 		&sqlWarning,
 		&stmtId,
-		&inputParamOffset,
-		NULL,//MFC
-		FALSE);
+		&inputParamOffset);
 
 	if (sql)
 		JNI_ReleaseByteArrayElements(jenv,sqlByteArray, (jbyte *)nSql, JNI_ABORT);
@@ -530,246 +520,3 @@
 	SRVR_STMT_HDL::resetFetchSize(dialogueId, stmtId, fetchSize);
 	FUNCTION_RETURN_VOID((NULL));
 }
-
-JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXPreparedStatement_cpqPrepareJNI
-(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId,
- jint txid, jboolean autoCommit, jint txnMode,
- jstring moduleName, jint moduleVersion, jlong moduleTimestamp, jstring stmtName,
- jboolean isSelect, jint queryTimeout, jint holdability, jint batchSize, jint fetchSize, jstring  sql,jboolean isISUD)
-{
-	FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_SQLMXPreparedStatement_cpqPrepare",("...txid=%ld, autoCommit=%s, ...\
-																			  txnMode=%ld, isSelect=%s, \
-																			  holdability=%ld, isISUD=%d...",
-																			  txid,
-																			  DebugBoolStr(autoCommit),
-																			  txnMode,
-																			  DebugBoolStr(isSelect),
-																			  holdability,isISUD));
-
-#ifndef TODO	// Linux port Todo:
-	ExceptionStruct				exception_;
-	long					estimatedCost;
-	long					inputParamOffset;
-	ERROR_DESC_LIST_def			sqlWarning;
-	SQLItemDescList_def			outputDesc;
-	SQLItemDescList_def			inputDesc;
-	jint						currentTxid = txid;
-	jint						externalTxid = 0;
-	long						stmtId;
-	short						txn_status;
-
-	SQLValue_def				sqlString;			// MFC - added this
-	const char					*nSql = NULL;
-	jbyteArray					sqlByteArray;
-	jboolean					isCopy;
-	jsize						len;
-
-	const char		*nModuleName = NULL;
-	const char		*nStmtName = NULL;
-
-	if (moduleName)
-		nModuleName = JNI_GetStringUTFChars(jenv,moduleName, NULL);
-	else
-	{
-		throwSQLException(jenv, INVALID_MODULE_NAME_ERROR, NULL, "HY000");
-		FUNCTION_RETURN_VOID(("moduleName is Null"));
-	}
-
-	// MFC - read the sqlstring
-	if (sql)
-	{
-		nSql = JNI_GetStringUTFChars(jenv,sql, NULL);
-		sqlString.dataValue._buffer = new unsigned char[strlen(nSql)+1];
-		strcpy(sqlString.dataValue._buffer, nSql);
-		sqlString.dataValue._length = strlen(nSql);
-
-		//Soln. No.: 10-110927-9875 - fix memory leak
-		JNI_ReleaseStringUTFChars(jenv,sql, nSql);
-	}
-	else
-	{
-		throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
-		FUNCTION_RETURN_VOID(("Null SQL string"));
-	}
-
-	if (stmtName)
-		nStmtName = JNI_GetStringUTFChars(jenv,stmtName, NULL);
-	else
-	{
-		throwSQLException(jenv, INVALID_STMT_LABEL_ERROR, NULL, "HY000");
-		FUNCTION_RETURN_VOID(("stmtName is Null"));
-	}
-
-
-	// MFC - coin module name
-
-	char pmoduleFileName[1024];
-	/*char pModuleNameForLoad[1024];
-
-	memset(pModuleNameForLoad, '\0', 1024);*/
-	memset(pmoduleFileName, '\0', 1024);
-
-	strcpy(pmoduleFileName, srvrGlobal->compiledModuleLocation);
-	strcat(pmoduleFileName, "/");
-	strcat(pmoduleFileName, srvrGlobal->CurrentCatalog);
-	strcat(pmoduleFileName, ".");
-	strcat(pmoduleFileName,srvrGlobal->CurrentSchema);
-	strcat(pmoduleFileName,".");
-	strcat(pmoduleFileName,MFCKEY);
-
-	
-	struct stat checkMF;
-	char* resMD5 = NULL;
-	bool bModuleExists = false;
-	resMD5 = MDMultiple2(dialogueId, sqlString.dataValue._buffer);
-	strcat(pmoduleFileName,resMD5);
-
-	if(resMD5 != NULL )
-	{
-		free(resMD5);
-		resMD5 = NULL;
-	}
-
-	std::string lockFile(pmoduleFileName);
-	lockFile.append(".lck");
-	int retCode = stat(lockFile.c_str(), &checkMF);
-	if(retCode != 0)
-	{
-		retCode = stat(pmoduleFileName, &checkMF);
-		if (retCode == 0)
-		{
-			bModuleExists = true;	
-		}
-	}
-	char pstmtLabel[1024];//, stmtLabelForLoadingModule;
-	memset(pstmtLabel, '\0', 1024);
-	// Check if the module is already loaded for this connection
-	// If so it cannot be used again.
-	SRVR_CONNECT_HDL *pConnection = (SRVR_CONNECT_HDL*)dialogueId;
-	bool isModuleLoadedForThisConnection = pConnection->isModuleLoaded(pmoduleFileName);
-
-	if (bModuleExists && !isModuleLoadedForThisConnection)
-	{
-		std::string strInput = sqlString.dataValue._buffer;
-		if((strInput.find_first_of("SELECT") == 0) || (strInput.find_first_of("select") == 0))
-		{
-			strcpy(pstmtLabel, "MXSTMT01");
-		}
-		else
-		{
-			strcpy(pstmtLabel,"SQLMX_DEFAULT_STATEMENT_");
-			int n = -1;
-			if(strcmp(srvrGlobal->CurrentSchema, "SEABASE") != 0 &&
-				strcmp(srvrGlobal->CurrentCatalog, "TRAFODION") != 0)
-			{
-				//n = srvrGlobal->setOfCQD.size()+4;
-				n = pConnection->listOfCQDs.size()+4;
-			}
-			else if(strcmp(srvrGlobal->CurrentSchema, "SEABASE") == 0 &&
-				strcmp(srvrGlobal->CurrentCatalog, "TRAFODION") == 0)
-			{
-				//n = srvrGlobal->setOfCQD.size()+2;
-				n = pConnection->listOfCQDs.size()+2;
-			}
-			char num[4];
-			memset(num, '\0', 4);
-			itoa(n,num,10);
-			strcat(pstmtLabel, num);
-		}
-	}
-	else
-	{
-		strcpy(pstmtLabel,nStmtName);
-	}
-	// MFC - if module is available call prepareFromModule else call prepare
-	if (bModuleExists && !isModuleLoadedForThisConnection)
-	{
-		pConnection->referenceCountForModuleLoaded(pmoduleFileName);
-		odbc_SQLSvc_PrepareFromModule_sme_(NULL, NULL,
-			&exception_,
-			dialogueId,
-			pmoduleFileName,
-			moduleVersion,
-			moduleTimestamp,
-			pstmtLabel,
-			(isSelect ? TYPE_SELECT : TYPE_UNKNOWN),
-			fetchSize,
-			batchSize,
-			holdability,
-			&estimatedCost,
-			&inputDesc,
-			&outputDesc,
-			&sqlWarning,
-			&stmtId,
-			&inputParamOffset);
-
-	}
-	else
-	{
-		odbc_SQLSvc_Prepare_sme_(NULL, NULL,
-			&exception_,
-			dialogueId,
-			pstmtLabel,
-			"",				// StmtExplainName
-			EXTERNAL_STMT,
-			&sqlString,
-			holdability,
-			(isSelect ? TYPE_SELECT : TYPE_UNKNOWN),
-			batchSize,
-			fetchSize,
-			queryTimeout,
-			&estimatedCost,
-			&inputDesc,
-			&outputDesc,
-			&sqlWarning,
-			&stmtId,
-			&inputParamOffset,
-			pmoduleFileName,
-				isISUD);
-	}
-	//Soln 10-111229-1174 -- start
-	if(sqlString.dataValue._buffer != NULL)
-	{
-		MEMORY_DELETE_ARRAY(sqlString.dataValue._buffer);
-		sqlString.dataValue._length = 0;
-	}
-	//Soln 10-111229-1174 -- end
-	if (moduleName)
-		JNI_ReleaseStringUTFChars(jenv,moduleName, nModuleName);
-
-	if (stmtName)
-		JNI_ReleaseStringUTFChars(jenv,stmtName, nStmtName);
-
-
-	switch (exception_.exception_nr)
-	{
-	case CEE_SUCCESS:
-		setPrepareOutputs(jenv, jobj, &inputDesc, &outputDesc, currentTxid, stmtId, inputParamOffset);
-		if (sqlWarning._length > 0)
-			setSQLWarning(jenv, jobj, &sqlWarning);
-		break;
-	case odbc_SQLSvc_PrepareFromModule_SQLQueryCancelled_exn_:
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
-			exception_.u.SQLQueryCancelled.sqlcode);
-		break;
-	case odbc_SQLSvc_PrepareFromModule_SQLError_exn_:
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, &exception_.u.SQLError);
-		break;
-	case odbc_SQLSvc_PrepareFromModule_ParamError_exn_:
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, MODULE_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
-		break;
-	case odbc_SQLSvc_PrepareFromModule_SQLStillExecuting_exn_:
-	case odbc_SQLSvc_PrepareFromModule_InvalidConnection_exn_:
-	case odbc_SQLSvc_PrepareFromModule_TransactionError_exn_:
-	default:
-		// TFDS - These exceptions should not happen
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
-		break;
-	}
-#endif	
-	FUNCTION_RETURN_VOID((NULL));
-}
diff --git a/core/conn/jdbc_type2/native/SqlInterface.cpp b/core/conn/jdbc_type2/native/SqlInterface.cpp
index 1484edb..49da3fd 100644
--- a/core/conn/jdbc_type2/native/SqlInterface.cpp
+++ b/core/conn/jdbc_type2/native/SqlInterface.cpp
@@ -41,8 +41,6 @@
 #include "CommonDiags.h"
 #include "Debug.h"
 #include "GlobalInformation.h"
-#include <map>	//MFC
-#include <sys/stat.h> // MFC
 #include <fcntl.h>
 //Added for CQDs filter
 
@@ -1206,21 +1204,6 @@
 	{
 		if (retcode!=SQL_SUCCESS) pSrvrStmt->isClosed = TRUE;
 	}
-	if (srvrGlobal->moduleCaching)
-	{
-		if ( (retcode == 8579) || (retcode == 8578) || (retcode == -1004) || (retcode == -4082) )
-		{
-			//If a module file exists and there is a DDL modification in the
-			//table, we handle it here and return the error to client.
-			std::string strModuleName = pSrvrStmt->moduleName;
-			if(strModuleName.find("T2MFC") != -1)
-			{
-				pConnect->removeFromLoadedModuleSet(strModuleName);
-				remove(strModuleName.c_str()); // removing the Module file
-			}
-		}
-	}
-
 	// Process the SQL CLI return code
 	if (retcode != 0){						// SQL success
 		if (retcode == 100) {				// No Data Found
@@ -1417,22 +1400,6 @@
 			retcode = CLI_DeallocStmt(pStmt);
 			if( trace_SQL ) LogDelete("SQL_EXEC_DeallocStmt(pStmt);",(void**)&pStmt,pStmt);
 		}
-		else
-		{
-			if (srvrGlobal->moduleCaching)
-			{
-				// Drop only the MFC Module.
-				SRVR_CONNECT_HDL *pConnect = (SRVR_CONNECT_HDL*)pSrvrStmt->dialogueId;
-				if(pSrvrStmt->moduleId.module_name != NULL)
-				{
-					if(pConnect->isModuleLoaded((const char *) pSrvrStmt->moduleId.module_name))
-					{
-						pConnect->removeFromLoadedModuleSet((const char *) pSrvrStmt->moduleId.module_name);
-						HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-					}
-				}
-			}
-		}
 		// For drop, always return success, even if there was a warning.
 		// This was migrated logic during IDL removal.
 		THREAD_RETURN(pSrvrStmt,SQL_SUCCESS);
@@ -2203,137 +2170,6 @@
 	CLI_DEBUG_RETURN_SQL((SQLRETURN)retcode);
 }
 
-SQLRETURN PREPARE_FROM_MODULE(SRVR_STMT_HDL* pSrvrStmt)
-{
-	FUNCTION_ENTRY("PREPARE_FROM_MODULE",
-		("pSrvrStmt=0x%08x",
-		pSrvrStmt));
-
-	long retcode = SQL_SUCCESS;
-
-	SQLSTMT_ID	*pStmt;
-	SQLDESC_ID	*pInputDesc;
-	SQLDESC_ID	*pOutputDesc;
-	int    SqlQueryStatementType;
-
-	long		numEntries;
-	char		*pStmtName;
-	BOOL		sqlWarning = FALSE;
-
-	pStmt       = &pSrvrStmt->stmt;
-	pInputDesc  = &pSrvrStmt->inputDesc;
-	pOutputDesc = &pSrvrStmt->outputDesc;
-
-	if (!pSrvrStmt->isClosed)
-	{
-		retcode = CLI_CloseStmt(pStmt);
-
-		if (retcode!=0)
-		{
-			retcode = CLI_ClearDiagnostics(pStmt);
-		}
-		pSrvrStmt->isClosed = TRUE;
-	}
-	if (pSrvrStmt->holdability == HOLD_CURSORS_OVER_COMMIT)
-	{
-		retcode = CLI_SetStmtAttr(&pSrvrStmt->stmt, SQL_ATTR_CURSOR_HOLDABLE, SQL_HOLDABLE, NULL);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-
-	// MFC  if mfc is on allocate descriptors even if descriptor name is NULL
-	if ((pSrvrStmt->useDefaultDesc) && (!srvrGlobal->moduleCaching))
-	{
-		if (pSrvrStmt->inputDescName[0] != '\0')
-		{
-			retcode = CLI_GetDescEntryCount(pInputDesc, (int *)&pSrvrStmt->paramCount);
-			HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-		}
-		else
-		{
-			pSrvrStmt->paramCount = 0;
-		}
-
-		if (pSrvrStmt->outputDescName[0] != '\0')
-		{
-			retcode = CLI_GetDescEntryCount(pOutputDesc, (int *)&pSrvrStmt->columnCount);
-			HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-		}
-		else
-			pSrvrStmt->columnCount = 0;
-
-	}
-	else
-	{
-		retcode = CLI_DescribeStmt(pStmt, pInputDesc, pOutputDesc);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
-		retcode = CLI_GetDescEntryCount(pInputDesc, (int *)&pSrvrStmt->paramCount);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
-		retcode = CLI_GetDescEntryCount(pOutputDesc, (int *)&pSrvrStmt->columnCount);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-
-	if (pSrvrStmt->paramCount > 0)
-	{
-		kdsCreateSQLDescSeq(&pSrvrStmt->inputDescList, pSrvrStmt->paramCount);
-		retcode = BuildSQLDesc(pSrvrStmt, SRVR_STMT_HDL::Input);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-	else
-	{
-		kdsCreateEmptySQLDescSeq(&pSrvrStmt->inputDescList);
-	}
-
-	if (pSrvrStmt->columnCount > 0)
-	{
-		kdsCreateSQLDescSeq(&pSrvrStmt->outputDescList, pSrvrStmt->columnCount);
-		retcode = BuildSQLDesc(pSrvrStmt, SRVR_STMT_HDL::Output);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-	else
-	{
-		kdsCreateEmptySQLDescSeq(&pSrvrStmt->outputDescList);
-	}
-
-	/* *****************************************************************************
-	* The call to SQL_EXEC_GetStmtAttr to query the statement type was added as a
-	* performance enhancement. Previous version of the Trafodion database will not return
-	* a statement type, but will return a 0 which is SQL_OTHER. In the case were
-	* SQL_OTHER is returned and JDBC/MX knows what the statement type is, then the
-	* JDBC/MX statement type will be used. This will allow the JDBC/MX driver to
-	* run with an older version of the Trafodion.
-	* ***************************************************************************** */
-
-
-	DEBUG_OUT(DEBUG_LEVEL_CLI,( "getSQLMX_Version: returned %i", GlobalInformation::getSQLMX_Version()));
-
-	if (GlobalInformation::getSQLMX_Version() == CLI_VERSION_R2 ) {    //If this version of Trafodion is version R2
-		if (pSrvrStmt->sqlStmtType != TYPE_UNKNOWN)                     //If this is a SELECT, INVOKE, or SHOWSHAPE
-			SqlQueryStatementType = SQL_SELECT_NON_UNIQUE;              //then force an execute with no fetch
-		else SqlQueryStatementType = SQL_OTHER;                         //else allow an executeFetch
-	}
-	else
-	{
-		retcode = CLI_GetStmtAttr( &pSrvrStmt->stmt,		// (IN) SQL statement ID
-			SQL_ATTR_QUERY_TYPE,		// (IN) Request query statement attribute
-			&SqlQueryStatementType,	// (OUT) Place to store query statement type
-			NULL,					// (OUT) Optional string
-			0,						// (IN) Max size of optional string buffer
-			NULL );					// (IN) Length of item
-		//If there is an error this statement will return
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-	DEBUG_OUT(DEBUG_LEVEL_CLI,("SQL Query Statement Type=%s",
-		CliDebugSqlQueryStatementType(SqlQueryStatementType)));
-	pSrvrStmt->setSqlQueryStatementType(SqlQueryStatementType);
-
-	CLI_DEBUG_SHOW_SERVER_STATEMENT(pSrvrStmt);
-
-	if (sqlWarning) THREAD_RETURN(pSrvrStmt,SQL_SUCCESS_WITH_INFO);
-	THREAD_RETURN(pSrvrStmt,SQL_SUCCESS);
-}
-
 SQLRETURN ALLOCSQLMXHDLS(SRVR_STMT_HDL* pSrvrStmt)
 {
 	FUNCTION_ENTRY("ALLOCSQLMXHDLS", ("pSrvrStmt=0x%08x",
@@ -2391,9 +2227,7 @@
 	}
 
 
-	// MFC if mfc is on allocate descriptors
-	if ( ((srvrGlobal->moduleCaching) /*&& (srvrGlobal->moduleExists)*/)
-		|| (!pSrvrStmt->useDefaultDesc))
+	if (!pSrvrStmt->useDefaultDesc)
 	{
 		pInputDesc = &pSrvrStmt->inputDesc;
 		pInputDesc->version = SQLCLI_ODBC_VERSION;
@@ -2481,8 +2315,7 @@
 	}
 
 	// Set the input and output Desc to be Wide Descriptors
-	if ( ((srvrGlobal->moduleCaching) /*&& (srvrGlobal->moduleExists)*/)
-		|| (!pSrvrStmt->useDefaultDesc))
+	if (!pSrvrStmt->useDefaultDesc)
 	{
 		DEBUG_OUT(DEBUG_LEVEL_CLI,("Non-Default descriptor."));
 		//R321: passing 1 instead of 0 for CLI_SetDescItem 
@@ -2922,1545 +2755,6 @@
 	CLI_DEBUG_RETURN_SQL(retcode);
 }
 
-// MFC - new method PREPARE + createModulePlan
-SQLRETURN PREPAREFORMFC(SRVR_STMT_HDL* pSrvrStmt)
-{
-	FUNCTION_ENTRY("PREPAREFORMFC",
-		("pSrvrStmt=0x%08x",
-		pSrvrStmt));
-
-#ifdef NSK_PLATFORM	// Linux port - Todo: Not supported
-	CLI_DEBUG_SHOW_SERVER_STATEMENT(pSrvrStmt);
-
-	long retcode;
-	SQLRETURN rc;
-
-	SQLSTMT_ID	*pStmt;
-	SQLDESC_ID	*pInputDesc;
-	SQLDESC_ID	*pOutputDesc;
-	SRVR_CONNECT_HDL *pConnect;
-
-	long		numEntries;
-	char		*pStmtName;
-	BOOL		sqlWarning = FALSE;
-	BOOL		rgWarning = FALSE;
-	int			SqlQueryStatementType;
-
-	pConnect = (SRVR_CONNECT_HDL *)pSrvrStmt->dialogueId;
-	pStmt = &pSrvrStmt->stmt;
-	pOutputDesc = &pSrvrStmt->outputDesc;
-	pInputDesc = &pSrvrStmt->inputDesc;
-
-	if (!pSrvrStmt->isClosed)
-	{
-		retcode = CLI_CloseStmt(pStmt);
-		if (retcode!=0)
-		{
-			retcode = CLI_ClearDiagnostics(pStmt);
-		}
-		pSrvrStmt->isClosed = TRUE;
-	}
-
-	if (pSrvrStmt->holdability == HOLD_CURSORS_OVER_COMMIT)
-	{
-		retcode = CLI_SetStmtAttr(pStmt, SQL_ATTR_CURSOR_HOLDABLE, SQL_HOLDABLE, NULL);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-
-	SQLDESC_ID	sqlString_desc;
-
-	sqlString_desc.version        = SQLCLI_ODBC_VERSION;
-	sqlString_desc.module         = &pSrvrStmt->moduleId;
-	sqlString_desc.name_mode      = string_data;
-	sqlString_desc.identifier     = (const char *)pSrvrStmt->sqlString.dataValue._buffer;
-	sqlString_desc.handle         = 0;
-	sqlString_desc.identifier_len = pSrvrStmt->sqlString.dataValue._length;
-	sqlString_desc.charset        = SQLCHARSETSTRING_ISO88591;
-
-	retcode = CLI_Prepare(pStmt, &sqlString_desc);
-
-	int rtn;
-
-#ifndef DISABLE_NOWAIT		
-	if (retcode == NOWAIT_PENDING)
-	{
-		rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex);
-		DEBUG_OUT(DEBUG_LEVEL_CLI,("WaitForCompletion() returned %d",rtn));
-
-		if (rtn == 0){
-			rc = pSrvrStmt->switchContext();
-			DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->switchContext() returned %ld", rc));
-			if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) THREAD_RETURN(pSrvrStmt,rc);
-
-			switch (pSrvrStmt->nowaitRetcode)
-			{
-			case 0:
-				retcode = 0;
-				break;
-			case 9999:
-				THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-			default:
-				retcode = GETSQLCODE(pSrvrStmt);
-				break;
-			}
-			DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s",
-				pSrvrStmt->nowaitRetcode,
-				CliDebugSqlError(retcode)));
-		}
-		else
-		{
-			pSrvrStmt->nowaitRetcode = rtn;
-			THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-		}
-	}
-#endif	
-	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
-	// MFC - to store the original statement names to use in map
-	pSrvrStmt->estimatedCost = -1;
-
-	retcode = CLI_DescribeStmt(pStmt, pInputDesc, pOutputDesc);
-	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
-	retcode = CLI_GetDescEntryCount(pInputDesc,(int*) &pSrvrStmt->paramCount);
-	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
-	retcode = CLI_GetDescEntryCount(pOutputDesc,(int *) &pSrvrStmt->columnCount);
-	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
-	pSrvrStmt->prepareSetup();
-
-	InputDescInfo *pInputDescInfo = NULL;
-	if (pSrvrStmt->paramCount > 0)
-	{
-		kdsCreateSQLDescSeq(&pSrvrStmt->inputDescList, pSrvrStmt->paramCount+pSrvrStmt->inputDescParamOffset);
-		pInputDescInfo = new InputDescInfo[pSrvrStmt->paramCount];
-		retcode = BuildSQLDesc(pSrvrStmt, SRVR_STMT_HDL::Input,pInputDescInfo);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-	else
-	{
-		kdsCreateEmptySQLDescSeq(&pSrvrStmt->inputDescList);
-	}
-	// MFC
-	// CLI_Prepare is over. Now create module definition file
-	// Dont create for Callable statements, the SQL String will begin with "{" for callable statements.
-    //CQDs filter -- start
-	//if(srvrGlobal->moduleCaching && pSrvrStmt->sqlString.dataValue._buffer[0] != '{')
-	if(srvrGlobal->moduleCaching && pSrvrStmt->isISUD)
-	{
-		struct stat checkMF;
-		int retCode;
-		
-		std::string moduleFileName = srvrGlobal->compiledModuleLocation;
-		moduleFileName.append("/");
-		moduleFileName.append(pConnet->CurrentCatalog);
-		moduleFileName.append(".");
-		moduleFileName.append(pConnet->CurrentSchema);
-		moduleFileName.append(".");
-		moduleFileName.append(MFCKEY);
-
-		char	*resMD5 = NULL;
-		resMD5 = MDMultiple2(pSrvrStmt->dialogueId,pSrvrStmt->sqlString.dataValue._buffer);
-		moduleFileName.append(resMD5);
-
-		//MFC If .lck already exists the module generation is in progress
-		std::string lockFile(moduleFileName);
-		lockFile.append(".lck");
-
-		retCode = stat(lockFile.c_str(), &checkMF);
-
-		if (retCode != 0 && pSrvrStmt->stmtType == EXTERNAL_STMT)
-		{
-			retCode = stat(moduleFileName.c_str(), &checkMF);
-			if(retCode != 0)
-			{
-				int fileDesc = open( lockFile.c_str(), O_RDONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IXUSR);
-				if (fileDesc >= 0 )
-				{
-					// MFC creation of .sql file nd then generating a .mdf and a module goes here
-					close(fileDesc);
-					CreateModulePlan(pSrvrStmt->paramCount, pInputDescInfo, pSrvrStmt->sqlString.dataValue._buffer,pSrvrStmt->dialogueId,resMD5);
-					
-				}
-			}
-		}
-		if (resMD5 != NULL )
-		{
-			free(resMD5);
-			resMD5 = NULL;
-		}
-	}
-
-	//Soln. No.: 10-111229-1174 fix memory leak
-	MEMORY_DELETE_ARRAY(pInputDescInfo);
-
-	// MFC - resume normal flow if a .lck file exists
-	if (pSrvrStmt->columnCount > 0)
-	{
-		kdsCreateSQLDescSeq(&pSrvrStmt->outputDescList, pSrvrStmt->columnCount);
-		retcode = BuildSQLDesc(pSrvrStmt, SRVR_STMT_HDL::Output);
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	} else {
-		kdsCreateEmptySQLDescSeq(&pSrvrStmt->outputDescList);
-	}
-
-	/* *****************************************************************************
-	* The call to CLI_GetStmtAttr to query the statement type was added as a
-	* performance enhancement. Previous versions of the Trafodion database will not return
-	* a statement type, but will return a 0 which is SQL_OTHER. In the case were
-	* SQL_OTHER is returned and JDBC/MX knows what the statement type is, then the
-	* JDBC/MX statement type will be used. This will allow the JDBC/MX driver to
-	* run with an older version of the Trafodion.
-	* ***************************************************************************** */
-
-
-	DEBUG_OUT(DEBUG_LEVEL_CLI,( "getSQLMX_Version: returned %i", GlobalInformation::getSQLMX_Version()));
-
-	if (GlobalInformation::getSQLMX_Version() == CLI_VERSION_R2 ) {    //If this version of Trafodion is version R2
-		if (pSrvrStmt->sqlStmtType != TYPE_UNKNOWN)                    //If this is a SELECT, INVOKE, or SHOWSHAPE
-			SqlQueryStatementType = SQL_SELECT_NON_UNIQUE;              //then force an execute with no fetch
-		else SqlQueryStatementType = SQL_OTHER;                         //else allow an executeFetch
-	}
-	else
-	{
-		retcode = CLI_GetStmtAttr( &pSrvrStmt->stmt,		// (IN) SQL statement ID
-			SQL_ATTR_QUERY_TYPE,		// (IN) Request query statement attribute
-			&SqlQueryStatementType,	// (OUT) Place to store query statement type
-			NULL,					// (OUT) Optional string
-			0,						// (IN) Max size of optional string buffer
-			NULL );					// (IN) Length of item
-
-
-		//If there is an error this statement will return
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-	}
-	DEBUG_OUT(DEBUG_LEVEL_CLI,("SQL Query Statement Type=%s",
-		CliDebugSqlQueryStatementType(SqlQueryStatementType)));
-	pSrvrStmt->setSqlQueryStatementType(SqlQueryStatementType);
-
-	switch (pSrvrStmt->getSqlQueryStatementType())
-	{
-	case SQL_CALL_NO_RESULT_SETS:
-		DEBUG_OUT(DEBUG_LEVEL_CLI|DEBUG_LEVEL_STMT,("Prepare SQL_CALL_NO_RESULT_SETS query type"));
-		pSrvrStmt->isSPJRS = false;		// Indicate this is an RS.
-		pSrvrStmt->RSIndex = 0;			// Index into RS array
-		pSrvrStmt->RSMax = 0;			// No Result Sets to return
-		DEBUG_OUT(DEBUG_LEVEL_CLI|DEBUG_LEVEL_STMT,("RSMax: %d  RSIndex: %d  isSPJRS: %d ", pSrvrStmt->RSMax, pSrvrStmt->RSIndex,  pSrvrStmt->isSPJRS));
-		break;
-
-	case SQL_CALL_WITH_RESULT_SETS:
-		DEBUG_OUT(DEBUG_LEVEL_CLI|DEBUG_LEVEL_STMT,("Prepare SQL_CALL_WITH_RESULT_SETS query type"));
-		pSrvrStmt->isSPJRS = true;
-		retcode = RSgetRSmax(pSrvrStmt);
-		DEBUG_OUT(DEBUG_LEVEL_CLI|DEBUG_LEVEL_STMT,("RSMax: %d  RSIndex: %d  isSPJRS: %d  ", pSrvrStmt->RSMax, pSrvrStmt->RSIndex,  pSrvrStmt->isSPJRS));
-		//If there is an error this statement will return
-		HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-		break;
-	}
-	
-	if (sqlWarning) THREAD_RETURN(pSrvrStmt,SQL_SUCCESS_WITH_INFO);
-#endif	
-	
-	THREAD_RETURN(pSrvrStmt,SQL_SUCCESS);
-}
-
-// MFC
-// Input Descriptor Info here for creating MDF file
-
-InputDescInfo::InputDescInfo()
-{
-	CountPosition = 0;
-	DataType = 0;
-	memset(DataTypeString, '\0', 50);
-	Length = 0;
-	DateTimeCode = 0;
-	Precision = 0;
-	SQLCharset = 0;
-	ODBCPrecision = 0;
-	ODBCDataType = 0;
-	Scale = 0;
-	Nullable = 0;
-	IntLeadPrec = 0;
-}
-
-InputDescInfo::~InputDescInfo()
-{
-	CountPosition = 0;
-	DataType = 0;
-	memset(DataTypeString, '\0', 50);
-	Length = 0;
-	DateTimeCode = 0;
-	Precision = 0;
-	SQLCharset = 0;
-	ODBCPrecision = 0;
-	ODBCDataType = 0;
-	Nullable = 0;
-	Scale = 0;
-	IntLeadPrec =0;
-}
-
-// MFC - method to map JDBC data types to Trafodion data types
-
-void InputDescInfo::setData(int countPosition, long dataType, long length, long scale,long nullable,
-							long dateTimeCode, long precision,long intLeadPrec, long sQLCharset, SRVR_GLOBAL_Def *srvrGlobal)
-{
-	CountPosition = countPosition;
-	DataType = dataType;
-	Length = length;
-	DateTimeCode = dateTimeCode;
-	Precision = precision;
-	SQLCharset = sQLCharset;
-	Scale = scale;
-	Nullable = nullable;
-	IntLeadPrec = intLeadPrec;
-	switch (DataType)
-	{
-	case SQLTYPECODE_CHAR:
-		ODBCPrecision = Length;
-		ODBCDataType = SQL_CHAR;
-		strcpy(DataTypeString, "char");
-		break;
-	case SQLTYPECODE_VARCHAR:
-	case SQLTYPECODE_VARCHAR_WITH_LENGTH:
-		ODBCPrecision = Length;
-		ODBCDataType = SQL_VARCHAR;
-		strcpy(DataTypeString, "VARCHAR");
-		if (Length >= 255)
-		{
-			ODBCDataType = SQL_LONGVARCHAR;
-			strcpy(DataTypeString, "VARCHAR");
-		}
-		break;
-	case SQLTYPECODE_VARCHAR_LONG:
-		ODBCPrecision = Length;
-		ODBCDataType = SQL_LONGVARCHAR;
-		strcpy(DataTypeString, "VARCHAR");
-		break;
-	case SQLTYPECODE_SMALLINT:
-		if (Precision == 0)
-		{
-			ODBCPrecision = 5;
-			ODBCDataType = SQL_SMALLINT;
-			strcpy(DataTypeString, "short");
-		}
-		else
-		{
-			ODBCPrecision = Precision;
-			ODBCDataType = SQL_NUMERIC;
-			strcpy(DataTypeString, "NUMERIC");
-		}
-		break;
-	case SQLTYPECODE_SMALLINT_UNSIGNED:
-		if (Precision == 0)
-		{
-			ODBCPrecision = 5;
-			ODBCDataType = SQL_SMALLINT;
-			strcpy(DataTypeString, "unsigned short");
-		}
-		else
-		{
-			ODBCPrecision = Precision;
-			ODBCDataType = SQL_NUMERIC;
-			strcpy(DataTypeString, "unsigned NUMERIC");
-		}
-		break;
-	case SQLTYPECODE_INTEGER:
-		if (Precision == 0)
-		{
-			ODBCPrecision = 10;
-			ODBCDataType = SQL_INTEGER;
-			strcpy(DataTypeString, "int");
-		}
-		else
-		{
-			ODBCPrecision = Precision;
-			ODBCDataType = SQL_NUMERIC;
-			strcpy(DataTypeString, "NUMERIC");
-		}
-		break;
-	case SQLTYPECODE_INTEGER_UNSIGNED:
-		if (Precision == 0)
-		{
-			ODBCPrecision = 10;
-			ODBCDataType = SQL_INTEGER;
-			strcpy(DataTypeString, "unsigned int");
-
-		}
-		else
-		{
-			ODBCPrecision = Precision;
-			ODBCDataType = SQL_NUMERIC;
-			strcpy(DataTypeString, "unsigned NUMERIC");
-		}
-		break;
-	case SQLTYPECODE_LARGEINT:
-		if (Precision == 0)
-		{
-			ODBCPrecision = 19;
-			ODBCDataType = SQL_BIGINT;
-			strcpy(DataTypeString, "long long");
-
-		}
-		else
-		{
-			ODBCPrecision = Precision;
-			ODBCDataType = SQL_NUMERIC;
-			strcpy(DataTypeString, "NUMERIC");
-		}
-		break;
-	case SQLTYPECODE_IEEE_REAL:
-	case SQLTYPECODE_TDM_REAL:
-		ODBCDataType = SQL_REAL;
-		ODBCPrecision = 7;
-		strcpy(DataTypeString, "float");
-		break;
-	case SQLTYPECODE_IEEE_DOUBLE:
-	case SQLTYPECODE_TDM_DOUBLE:
-		ODBCDataType = SQL_DOUBLE;
-		ODBCPrecision = 15;
-		strcpy(DataTypeString, "double");
-		break;
-	case SQLTYPECODE_DATETIME:
-		switch (DateTimeCode)
-		{
-		case SQLDTCODE_DATE:					//1
-			ODBCDataType = SQL_DATE;
-			ODBCPrecision = 10;
-			strcpy(DataTypeString, "DATE");
-			break;
-		case SQLDTCODE_TIME:					//2
-			ODBCDataType = SQL_TIME;
-			strcpy(DataTypeString, "TIME");
-			if (Precision == 0)
-			{
-				ODBCPrecision = 8;
-			}
-			else
-			{
-				ODBCDataType = SQL_TIMESTAMP;
-				ODBCPrecision = 20+Precision;
-				strcpy(DataTypeString, "TIMESTAMP");
-			}
-			break;
-		case SQLDTCODE_TIMESTAMP:				//3
-			ODBCDataType = SQL_TIMESTAMP;
-			strcpy(DataTypeString, "TIMESTAMP");
-			if (Precision == 0)
-			{
-				ODBCPrecision = 19;
-			}
-			else
-			{
-				ODBCPrecision = 20+Precision;
-			}
-			break;
-			//
-			// Mapping Non-standard SQL/MP DATETIME types to DATE/TIME/TIMESTAMP
-			//
-
-		default:
-			ODBCDataType = SQL_TYPE_NULL;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "SQL_TYPE_NULL");
-			break;
-		} // switch datetime ends
-		break;
-	case SQLTYPECODE_DECIMAL_UNSIGNED:
-		ODBCPrecision = Length;
-		ODBCDataType = SQL_DECIMAL;
-		strcpy(DataTypeString, "unsigned DECIMAL");
-		break;
-	case SQLTYPECODE_DECIMAL:
-		ODBCPrecision = Length;
-		ODBCDataType = SQL_DECIMAL;
-		strcpy(DataTypeString, "DECIMAL");
-		break;
-	case SQLTYPECODE_DECIMAL_LARGE_UNSIGNED: // Tandem extension
-		ODBCDataType = SQL_DOUBLE; // Since there is no corresponding JDBC DataType, Map it as a double
-		ODBCPrecision = 15;
-		strcpy(DataTypeString, "double");
-		break;
-	case SQLTYPECODE_DECIMAL_LARGE: // Tandem extension
-		ODBCDataType = SQL_DOUBLE; // Since there is no corresponding JDBC DataType, Map it as a double
-		ODBCPrecision = 15;
-		strcpy(DataTypeString, "double");
-		break;
-	case SQLTYPECODE_INTERVAL:		// Interval will be sent in ANSIVARCHAR format
-		switch (DateTimeCode)
-		{
-		case SQLINTCODE_YEAR:
-			ODBCDataType = SQL_INTERVAL_YEAR;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL YEAR");
-			break;
-		case SQLINTCODE_MONTH:
-			ODBCDataType = SQL_INTERVAL_MONTH;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL MONTH");
-			break;
-		case SQLINTCODE_DAY:
-			ODBCDataType = SQL_INTERVAL_DAY;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL DAY");
-			break;
-		case SQLINTCODE_HOUR:
-			ODBCDataType = SQL_INTERVAL_HOUR;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL HOUR");
-			break;
-		case SQLINTCODE_MINUTE:
-			ODBCDataType = SQL_INTERVAL_MINUTE;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL MINUTE");
-			break;
-		case SQLINTCODE_SECOND:
-			ODBCDataType = SQL_INTERVAL_SECOND;
-			ODBCPrecision = Precision;
-			strcpy(DataTypeString, "INTERVAL SECOND");
-			break;
-		case SQLINTCODE_YEAR_MONTH:
-			ODBCDataType = SQL_INTERVAL_YEAR_TO_MONTH;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL YEAR TO MONTH");
-			break;
-		case SQLINTCODE_DAY_HOUR:
-			ODBCDataType = SQL_INTERVAL_DAY_TO_HOUR;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL DAY TO HOUR");
-			break;
-		case SQLINTCODE_DAY_MINUTE:
-			ODBCDataType = SQL_INTERVAL_DAY_TO_MINUTE;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL DAY TO MINUTE");
-			break;
-		case SQLINTCODE_DAY_SECOND:
-			ODBCDataType = SQL_INTERVAL_DAY_TO_SECOND;
-			ODBCPrecision = Precision;
-			strcpy(DataTypeString, "INTERVAL DAY TO SECOND");
-			break;
-		case SQLINTCODE_HOUR_MINUTE:
-			ODBCDataType = SQL_INTERVAL_HOUR_TO_MINUTE;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "INTERVAL HOUR TO MINUTE");
-			break;
-		case SQLINTCODE_HOUR_SECOND:
-			ODBCDataType = SQL_INTERVAL_HOUR_TO_SECOND;
-			ODBCPrecision = Precision;
-			strcpy(DataTypeString, "INTERVAL HOUR TO SECOND");
-			break;
-		case SQLINTCODE_MINUTE_SECOND:
-			ODBCDataType = SQL_INTERVAL_MINUTE_TO_SECOND;
-			ODBCPrecision = Precision;
-			strcpy(DataTypeString, "INTERVAL MINUTE TO SECOND");
-			break;
-		default:
-			ODBCDataType = SQL_TYPE_NULL;
-			ODBCPrecision = 0;
-			strcpy(DataTypeString, "SQL_TYPE_NULL");
-			break;
-		}
-		break;
-	case SQLTYPECODE_CLOB:
-		ODBCPrecision = Length;
-		ODBCDataType = TYPE_CLOB;
-		strcpy(DataTypeString, "CLOB");
-		break;	
-	case SQLTYPECODE_BLOB:
-		ODBCPrecision = Length;
-		ODBCDataType = TYPE_BLOB;
-		strcpy(DataTypeString, "BLOB");
-		break;	
-	default:
-		ODBCDataType = SQL_TYPE_NULL;
-		ODBCPrecision = 0;
-		strcpy(DataTypeString, "SQL_TYPE_NULL");
-		break;
-	}
-}
-
-// MFC BuildDesc and return InputDescInfo
-
-SQLRETURN BuildSQLDesc(SRVR_STMT_HDL*pSrvrStmt, SRVR_STMT_HDL::DESC_TYPE descType,InputDescInfo *pInputDescInfo)
-{
-	FUNCTION_ENTRY("BuildSQLDesc", ("pSrvrStmt=0x%08x, pSrvrStmt->stmtName = %s, SQL Statement = %s, descType=%s",
-		pSrvrStmt,
-		pSrvrStmt->stmtName,
-		pSrvrStmt->sqlString.dataValue._buffer,
-		CliDebugDescTypeStr(descType)));
-
-	long retcode = SQL_SUCCESS;
-	short i;
-	short j;
-	short k;
-
-	BOOL sqlWarning = FALSE;
-
-	long *totalMemLen = pSrvrStmt->getDescBufferLenPtr(descType);
-	long numEntries = pSrvrStmt->getDescEntryCount(descType);
-	SQLDESC_ID *pDesc = pSrvrStmt->getDesc(descType);
-	SQLItemDescList_def *SQLDesc = pSrvrStmt->getDescList(descType);
-	SQLItemDesc_def *SQLItemDesc = (SQLItemDesc_def *)SQLDesc->_buffer + SQLDesc->_length;
-
-	SRVR_DESC_HDL *implDesc = pSrvrStmt->allocImplDesc(descType);
-
-	// The following routine is hard coded for at least 15 items, so make sure it does not change
-	DEBUG_ASSERT(NO_OF_DESC_ITEMS>= 16,("NO_OF_DESC_ITEMS(%d) is less than 16",NO_OF_DESC_ITEMS));
-	*totalMemLen = 0;
-	for (i = 0; i < numEntries; i++) {
-		SQLItemDesc = (SQLItemDesc_def *)SQLDesc->_buffer + SQLDesc->_length;
-		// Initialize the desc entry in SQLDESC_ITEM struct
-		for (j = 0; j < NO_OF_DESC_ITEMS ; j++) {
-			gDescItems[j].entry = i+1;
-		}
-		gDescItems[10].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[11].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[12].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[13].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[14].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-
-		retcode = CLI_GetDescItems2(pDesc,
-			NO_OF_DESC_ITEMS,
-			(SQLDESC_ITEM *)&gDescItems);
-		HANDLE_ERROR(retcode, sqlWarning);
-
-		SQLItemDesc->dataType     = gDescItems[0].num_val_or_len;
-		SQLItemDesc->maxLen       = gDescItems[1].num_val_or_len;
-		SQLItemDesc->precision    = (short)gDescItems[2].num_val_or_len;
-		SQLItemDesc->scale        = (short)gDescItems[3].num_val_or_len;
-		SQLItemDesc->nullInfo     = (BOOL)gDescItems[4].num_val_or_len;
-		SQLItemDesc->paramMode    = gDescItems[5].num_val_or_len;
-		SQLItemDesc->intLeadPrec  = gDescItems[6].num_val_or_len;
-		SQLItemDesc->datetimeCode = gDescItems[7].num_val_or_len;
-		SQLItemDesc->SQLCharset   = gDescItems[8].num_val_or_len;
-		SQLItemDesc->fsDataType   = gDescItems[9].num_val_or_len;
-		for (k = 10; k < 15; k++) {
-			gDescItems[k].string_val[gDescItems[k].num_val_or_len] = '\0';
-		}
-		SQLItemDesc->vc_ind_length = gDescItems[15].num_val_or_len;
-
-		SQLItemDesc->maxLen = AdjustCharLength(descType, SQLItemDesc->SQLCharset, SQLItemDesc->maxLen);
-
-		GetJDBCValues(	SQLItemDesc, 			// Input
-			*totalMemLen,
-			gDescItems[14].string_val);
-
-		implDesc[i].charSet         = SQLItemDesc->SQLCharset;
-		implDesc[i].dataType        = SQLItemDesc->dataType;
-		implDesc[i].length          = SQLItemDesc->maxLen;
-		implDesc[i].precision       = SQLItemDesc->ODBCPrecision;
-		implDesc[i].scale           = SQLItemDesc->scale;
-		implDesc[i].sqlDatetimeCode = SQLItemDesc->datetimeCode;
-		implDesc[i].FSDataType      = SQLItemDesc->fsDataType;
-		implDesc[i].paramMode       = SQLItemDesc->paramMode;
-		implDesc[i].vc_ind_length   = SQLItemDesc->vc_ind_length;
-
-		SQLItemDesc->version = 0;
-
-		strcpy(SQLItemDesc->catalogNm, gDescItems[10].string_val);
-		strcpy(SQLItemDesc->schemaNm, gDescItems[11].string_val);
-		strcpy(SQLItemDesc->tableNm, gDescItems[12].string_val);
-		strcpy(SQLItemDesc->colNm, gDescItems[13].string_val);
-		strcpy(SQLItemDesc->colLabel, gDescItems[14].string_val);
-
-		SQLDesc->_length++;
-
-	}
-
-	if ((srvrGlobal->moduleCaching) &&(descType == SRVR_STMT_HDL::Input)&& (pSrvrStmt->stmtType == EXTERNAL_STMT))
-	{
-		retcode = BuildSQLDesc2ForModFile(pSrvrStmt->inputDesc, pSrvrStmt->paramCount, pInputDescInfo);
-		HANDLE_ERROR(retcode, sqlWarning);
-	}
-	retcode = SET_DATA_PTR(pSrvrStmt, descType);
-	HANDLE_ERROR(retcode, sqlWarning);
-
-	if (sqlWarning) CLI_DEBUG_RETURN_SQL(SQL_SUCCESS_WITH_INFO);
-	CLI_DEBUG_RETURN_SQL(SQL_SUCCESS);
-}
-
-
-//MFC - Build input descriptors for module file generation
-
-SQLRETURN BuildSQLDesc2ForModFile(SQLDESC_ID pDesc,long numEntries,InputDescInfo *&pInputDescInfo)
-{
-	long retcode = SQL_SUCCESS;
-	BOOL sqlWarning = FALSE;
-
-	long DataType;
-	long DateTimeCode;
-	long Length;
-	long Precision;
-	long Scale;
-	long SQLCharset;
-	long FSDataType;
-	long IntLeadPrec;
-	long Nullable;
-
-	for (int i = 0; i < numEntries; i++)
-	{
-		// Initialize the desc entry in SQLDESC_ITEM struct
-		for (int j = 0; j < NO_OF_DESC_ITEMS ; j++)
-		{
-			gDescItems[j].entry = i+1;
-		}
-		gDescItems[10].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[11].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[12].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[13].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-		gDescItems[14].num_val_or_len = MAX_ANSI_NAME_LEN+1;
-
-
-
-		retcode = CLI_GetDescItems2(&pDesc,
-			NO_OF_DESC_ITEMS,
-			(SQLDESC_ITEM *)&gDescItems);
-
-
-		DataType = gDescItems[0].num_val_or_len;
-		Length = gDescItems[1].num_val_or_len;
-		Precision = gDescItems[2].num_val_or_len;
-		Scale = gDescItems[3].num_val_or_len;
-		Nullable = gDescItems[4].num_val_or_len;
-		DateTimeCode = gDescItems[7].num_val_or_len;
-		SQLCharset = gDescItems[8].num_val_or_len;
-		FSDataType = gDescItems[9].num_val_or_len;
-		IntLeadPrec = gDescItems[6].num_val_or_len;
-		for (int k = 10; k < NO_OF_DESC_ITEMS; k++) {
-			gDescItems[k].string_val[gDescItems[k].num_val_or_len] = '\0';
-		}
-		if (DataType == SQLTYPECODE_NUMERIC || DataType == SQLTYPECODE_NUMERIC_UNSIGNED)
-		{
-			switch (FSDataType)
-			{
-			case 130:
-				DataType = SQLTYPECODE_SMALLINT;
-				break;
-			case 131:
-				DataType = SQLTYPECODE_SMALLINT_UNSIGNED;
-				break;
-			case 132:
-            case 156: //MFC support for BigNum
-				DataType = SQLTYPECODE_INTEGER;
-				break;
-			case 133:
-			case 155: //MFC support for BigNum
-				DataType = SQLTYPECODE_INTEGER_UNSIGNED;
-				break;
-			case 134:
-				DataType = SQLTYPECODE_LARGEINT;
-				break;
-			default:
-				break;
-			}
-		}
-		pInputDescInfo[i].setData(i, DataType, Length,Scale,Nullable, DateTimeCode, Precision,IntLeadPrec,SQLCharset, srvrGlobal);
-	}
-
-
-	if (sqlWarning)
-	{
-		return SQL_SUCCESS_WITH_INFO;
-	}
-	else
-	{
-		return SQL_SUCCESS;
-	}
-}
-
-// MFC method to create the module file and store it on disk
-
-void CreateModulePlan(long inputParamCount, InputDescInfo *inputDescInfo, char *inputsqlString,long dialogueId,const char *resMD5)
-{
-
-	SRVR_CONNECT_HDL *pConnect = (SRVR_CONNECT_HDL *)dialogueId;
-	FILE *ModuleCachingFile = NULL;
-	int containDecimal = false;
-
-	char temp_Str[256];
-	memset(temp_Str, '\0', 256);
-	char temp_Param[20];
-	memset(temp_Param, '\0', 20);
-	int noOfParam = inputParamCount - 1;
-	std::string ModuleName;
-	bool *indparam = new bool[inputParamCount];
-	memset(indparam, false, inputParamCount);
-
-	ModuleName.append(pConnect->CurrentCatalog);
-	ModuleName.append(".");
-	ModuleName.append(pConnect->CurrentSchema);
-	ModuleName.append(".");
-	ModuleName.append(MFCKEY);
-	ModuleName.append(resMD5);
-
-	std::string ModCachfilename;
-	ModCachfilename.append(srvrGlobal->compiledModuleLocation);
-	ModCachfilename.append("/");
-	ModCachfilename.append(ModuleName);
-	ModCachfilename.append(".sql");
-
-	// Open the module file
-	ModuleCachingFile = fopen(ModCachfilename.c_str(),"wt");
-
-	fprintf(ModuleCachingFile,"#if(0)\n%s \n#endif \n\n", inputsqlString);
-
-	fprintf(ModuleCachingFile,"# include<stdio.h>\n\n");
-	fprintf(ModuleCachingFile,"EXEC SQL MODULE %s NAMES ARE ISO88591;\n",ModuleName.c_str());
-	fprintf(ModuleCachingFile,"int main ()\n");
-	fprintf(ModuleCachingFile,"{\n");
-	fprintf(ModuleCachingFile," EXEC SQL BEGIN DECLARE SECTION;\n");
-
-	//Declare variables for every input
-
-	for (int pcount = 0; pcount < inputParamCount; pcount++)
-	{
-		switch(inputDescInfo[pcount].DataType)
-		{
-		case SQLTYPECODE_CHAR:
-			fprintf(ModuleCachingFile, "%s param%d[%d];\n",inputDescInfo[pcount].DataTypeString, pcount, (inputDescInfo[pcount].Length)+1);
-			if(inputDescInfo[pcount].Nullable)
-			{
-				indparam[pcount] = true;
-				fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-			}
-			break;
-
-		case SQLTYPECODE_VARCHAR:
-			if (inputDescInfo[pcount].Length >= 255)
-			{
-				fprintf(ModuleCachingFile, "%s param%d[%d];\n",inputDescInfo[pcount].DataTypeString, pcount, (inputDescInfo[pcount].Length)+1);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-			}
-			else
-			{
-				fprintf(ModuleCachingFile, "%s param%d[%d];\n",inputDescInfo[pcount].DataTypeString, pcount, (inputDescInfo[pcount].Length)+1);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_VARCHAR_WITH_LENGTH:
-			if (inputDescInfo[pcount].Length >= 255)
-			{
-				fprintf(ModuleCachingFile, "%s param%d[%d];\n",inputDescInfo[pcount].DataTypeString, pcount, (inputDescInfo[pcount].Length)+1);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			else
-			{
-				fprintf(ModuleCachingFile, "%s param%d[%d];\n",inputDescInfo[pcount].DataTypeString, pcount, (inputDescInfo[pcount].Length)+1);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_VARCHAR_LONG:
-			{
-				fprintf(ModuleCachingFile, "%s param%d[%d];\n",inputDescInfo[pcount].DataTypeString, pcount, (inputDescInfo[pcount].Length)+1);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_SMALLINT:
-			if (inputDescInfo[pcount].Precision == 0)
-			{
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			else
-			{
-				fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision,inputDescInfo[pcount].Scale,pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_LARGEINT:
-			if (inputDescInfo[pcount].Precision == 0)
-			{
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			else
-			{
-				fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision,inputDescInfo[pcount].Scale,pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-		case SQLTYPECODE_SMALLINT_UNSIGNED:
-			if (inputDescInfo[pcount].Precision == 0)
-			{
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			else
-			{
-				fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision,inputDescInfo[pcount].Scale,pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-		case SQLTYPECODE_INTEGER:
-			if (inputDescInfo[pcount].Precision == 0)
-			{
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			else
-			{
-				fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision,inputDescInfo[pcount].Scale,pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_INTEGER_UNSIGNED:
-			if (inputDescInfo[pcount].Precision == 0)
-			{
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			else
-			{
-				fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision,inputDescInfo[pcount].Scale,pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-
-		case SQLTYPECODE_IEEE_FLOAT:
-			{
-				fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_IEEE_DOUBLE:
-			{
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_DATETIME:
-			switch (inputDescInfo[pcount].DateTimeCode)
-			{
-			case SQLDTCODE_DATE:					//1
-				{
-					fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-
-			case SQLDTCODE_TIME:					//2
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision, pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-
-				if (inputDescInfo[pcount].Precision == 0)
-				{
-					//ODBCPrecision = 8;
-				}
-				else
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision, pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-
-			case SQLDTCODE_TIMESTAMP:				//3
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Precision, pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-
-				if (inputDescInfo[pcount].Precision == 0)
-				{
-					//ODBCPrecision = 19;
-				}
-				else
-				{
-					//ODBCPrecision = 20+Precision;
-				}
-				break;
-			default:
-				{
-					fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			}
-			break;
-		case SQLTYPECODE_DECIMAL_UNSIGNED:
-			{
-				containDecimal = true;
-				fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Length,inputDescInfo[pcount].Scale,pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-		case SQLTYPECODE_DECIMAL:
-			{
-				containDecimal = true;
-				fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].Length,inputDescInfo[pcount].Scale,pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-		case SQLTYPECODE_DECIMAL_LARGE_UNSIGNED: // Tandem extension
-			{
-				containDecimal = true;
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-		case SQLTYPECODE_DECIMAL_LARGE: // Tandem extension
-			{
-				containDecimal = true;
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		case SQLTYPECODE_INTERVAL:		// Interval will be sent in ANSIVARCHAR format
-			switch (inputDescInfo[pcount].DateTimeCode)
-			{
-			case SQLINTCODE_YEAR:
-
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_MONTH:
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_DAY:
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_HOUR:
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_MINUTE:
-				{
-					fprintf(ModuleCachingFile, "%s(%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_SECOND:
-				{
-					fprintf(ModuleCachingFile, "%s(%d,%d) param%d;\n",inputDescInfo[pcount].DataTypeString,inputDescInfo[pcount].IntLeadPrec,inputDescInfo[pcount].Precision,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_YEAR_MONTH:
-				{
-					fprintf(ModuleCachingFile, "INTERVAL YEAR(%d) TO MONTH param%d;\n", inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_DAY_HOUR:
-				{
-					fprintf(ModuleCachingFile, "INTERVAL DAY(%d) TO HOUR param%d;\n", inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			case SQLINTCODE_DAY_MINUTE:
-				{
-					fprintf(ModuleCachingFile, "INTERVAL DAY(%d) TO MINUTE param%d;\n", inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-				}
-				break;
-			case SQLINTCODE_DAY_SECOND:
-				{
-					fprintf(ModuleCachingFile, "INTERVAL DAY(%d) TO SECOND(%d) param%d;\n", inputDescInfo[pcount].IntLeadPrec,inputDescInfo[pcount].Precision,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-				}
-				break;
-			case SQLINTCODE_HOUR_MINUTE:
-				{
-					fprintf(ModuleCachingFile, "INTERVAL HOUR(%d) TO MINUTE param%d;\n", inputDescInfo[pcount].IntLeadPrec,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-				}
-				break;
-			case SQLINTCODE_HOUR_SECOND:
-				{
-					fprintf(ModuleCachingFile, "INTERVAL HOUR(%d) TO SECOND(%d) param%d;\n", inputDescInfo[pcount].IntLeadPrec,inputDescInfo[pcount].Precision,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-				}
-				break;
-			case SQLINTCODE_MINUTE_SECOND:
-				{
-					fprintf(ModuleCachingFile, "INTERVAL MINUTE(%d) TO SECOND(%d) param%d;\n", inputDescInfo[pcount].IntLeadPrec,inputDescInfo[pcount].Precision,pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			default:
-				{
-					fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-					if(inputDescInfo[pcount].Nullable)
-					{
-						indparam[pcount] = true;
-						fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-					}
-
-				}
-				break;
-			}
-			// Calculate the length based on Precision and IntLeadPrec
-			// The max. length is for Day to Fraction(6)
-			// Sign = 1
-			// Day = IntLeadPrec + 1 ( 1 for Blank space)
-			// Hour = 3 ( 2+1)
-			// Minute = 3 (2+1)
-			// Seconds = 3 (2+1)
-			// Fraction = Precision
-			break;
-		default:
-			{
-				fprintf(ModuleCachingFile, "%s param%d;\n",inputDescInfo[pcount].DataTypeString, pcount);
-				if(inputDescInfo[pcount].Nullable)
-				{
-					indparam[pcount] = true;
-					fprintf(ModuleCachingFile,"short param%d_ind = -1;\n",pcount);
-				}
-
-			}
-			break;
-
-		}
-	}
-
-	fprintf(ModuleCachingFile,"EXEC SQL END DECLARE SECTION  ;\n");
-
-	SRVR_CONNECT_HDL *connectHandle =(SRVR_CONNECT_HDL*)dialogueId;
-	std::list<std::string>::iterator iter;
-	for( iter = connectHandle->listOfCQDs.begin(); iter != connectHandle->listOfCQDs.end(); ++iter)
-	{
-		fprintf(ModuleCachingFile,"EXEC SQL %s;\n", iter->c_str());
-	}
-	if(strcmp(pConnect->CurrentSchema, "SEABASE") != 0 && strcmp(srvrGlobal->CurrentCatalog, "TRAFODION") != 0)
-	{
-		fprintf(ModuleCachingFile,"EXEC SQL DECLARE SCHEMA %s.%s ; \n",srvrGlobal->CurrentCatalog,srvrGlobal->CurrentSchema);
-		fprintf(ModuleCachingFile,"EXEC SQL SET SCHEMA %s.%s ; \n", srvrGlobal->CurrentCatalog,srvrGlobal->CurrentSchema);
-	}
-
-	std::string inputstring = inputsqlString;
-	std::string strParam = ":param";
-	std::string _inputstring = inputsqlString;
-
-	char* tempsqlstr = (char*)malloc(strlen(inputsqlString) +1);
-	memset(tempsqlstr, '\0', strlen(inputsqlString) +1);
-	strcpy(tempsqlstr, inputsqlString);
-	strToUpper(tempsqlstr);
-	char *saveptr=NULL;
-	char *sqlType = strtok_r(tempsqlstr," \t\n",&saveptr);
-	int pos = -1;
-	
-	// This is becuase we need the indicator variables declared for Insert,Update & Delete kind of statements
-	while(inputstring.rfind("?",pos) != -1 && noOfParam >= 0) 
-	{
-		memset(temp_Param, '\0', 20);
-		pos = inputstring.rfind("?",pos);
-		sprintf(temp_Param, "%d", noOfParam);
-		strParam.append(temp_Param);
-		
-		if(indparam[noOfParam])
-		{
-			strParam.append(" :");
-			strParam.append("param");
-			strParam.append(temp_Param);
-			strParam.append("_ind ");
-		}
-		_inputstring.replace(inputstring.rfind("?",pos), 1, strParam);
-		strParam = ":param";
-		noOfParam--;
-		pos--;
-	}
-	inputstring = _inputstring;
-
-	delete [] indparam;
-
-	if(sqlType != NULL && strcmp(sqlType, "SELECT") == 0 )
-	{
-
-		fprintf(ModuleCachingFile,"EXEC SQL DECLARE MXSTMT01 CURSOR FOR %s ;\n",inputstring.c_str());
-	}
-	else
-	{
-		fprintf(ModuleCachingFile,"EXEC SQL %s ;\n",inputstring.c_str());
-	}
-
-	fprintf(ModuleCachingFile,"return 0; \n }\n");
-
-	fclose(ModuleCachingFile);
-
-
-	if( tempsqlstr != NULL )
-	{
-		free(tempsqlstr);
-		tempsqlstr = NULL;
-	}
-
-	std::string strModuleFileName = std::string(ModCachfilename).substr(0, std::string(ModCachfilename).find(".sql"));
-
-	std::string string_Command;
-	int exeret = -1;
-
-	string_Command.append("/usr/tandem/sqlmx/bin/mxsqlc ");
-	string_Command.append(strModuleFileName.c_str());
-	string_Command.append(".sql -m ");
-	string_Command.append(strModuleFileName.c_str());
-	string_Command.append(".mdf -t 1234567890 -a -o");
-	#ifdef _LP64
-		string_Command.append(" -U 64");
-   /*  #else
-		string_Command.append(" -U 32");
-    */
-	#endif
-
-	//Solution 10-090915-4598 -- start
-	string_Command.append(" > ");
-	string_Command.append(strModuleFileName.c_str());
-	string_Command.append(".err 2>&1");
-	//Solution 10-090915-4598 -- end
-
-	// Workaround for Solution 10-121212-5698
-	// In system() the child process is unable to access the memory location where command string is located
-	// 1) explicitly allocated memory on heap
-	// 2) copy the command string to newly allocated heap memory
-	// 3) pass that string to system()
-	//int exeret = system(string_Command.c_str());
-
-	char* temp_cmd = (char*)malloc(string_Command.length() + 1);
-	if( temp_cmd != NULL)
-	{
-		memset(temp_cmd, '\0', string_Command.length() +1 );
-		strncpy(temp_cmd, string_Command.c_str(), string_Command.length() );
-		exeret = system(temp_cmd);
-		free(temp_cmd);
-		temp_cmd = NULL;
-	}
-		
-	if(exeret == 0 && containDecimal == true)
-	{
-		std::string string_ReplaceDecimal;
-		string_ReplaceDecimal.append("/bin/sed -e 's/LSDECIMAL/DECIMAL/g' ");
-		string_ReplaceDecimal.append(strModuleFileName);
-		string_ReplaceDecimal.append(".mdf > ");
-		string_ReplaceDecimal.append(strModuleFileName);
-		string_ReplaceDecimal.append(".mdfc");
-
-		// Workaround for Solution 10-121212-5698
-		//exeret = system(string_ReplaceDecimal.c_str());
-		char* temp_cmd = (char*)malloc(string_ReplaceDecimal.length() + 1);
-		if(temp_cmd != NULL)
-		{
-			memset(temp_cmd, '\0', string_ReplaceDecimal.length() +1 );
-			strncpy(temp_cmd, string_ReplaceDecimal.c_str(), string_ReplaceDecimal.length() );
-			exeret = system(temp_cmd);
-			free(temp_cmd);
-			temp_cmd = NULL;
-		}
-
-		if(exeret == 0)
-		{
-			string_ReplaceDecimal.erase();
-			string_ReplaceDecimal.append("mv -f ");
-			string_ReplaceDecimal.append(strModuleFileName);
-			string_ReplaceDecimal.append(".mdfc ");
-			string_ReplaceDecimal.append(strModuleFileName);
-			string_ReplaceDecimal.append(".mdf");
-			// Workaround for Solution 10-121212-5698
-			//exeret = system(string_ReplaceDecimal.c_str());
-			char* temp_cmd = (char*)malloc(string_ReplaceDecimal.length() + 1);
-			if(temp_cmd != NULL)
-			{
-				memset(temp_cmd, '\0', string_ReplaceDecimal.length() +1 );
-				strncpy(temp_cmd, string_ReplaceDecimal.c_str(), string_ReplaceDecimal.length() );
-				exeret = system(temp_cmd);
-				free(temp_cmd);
-				temp_cmd = NULL;
-			}
-		}
-	}
-
-	std::string string_Script;
-	if(exeret == 0)
-	{
-		string_Script.append("/G/SYSTEM/SYSTEM/mxcmp -g moduleLocal=");
-		string_Script.append(srvrGlobal->compiledModuleLocation);
-		string_Script.append(" ");
-		string_Script.append(strModuleFileName);
-		string_Script.append(".mdf");
-		//Solution 10-090915-4598 -- start
-		string_Script.append(" > ");
-		string_Script.append(strModuleFileName);
-		string_Script.append(".err 2>&1");
-		//Solution 10-090915-4598 -- end
-
-		// Workaround for Solution 10-121212-5698
-		//exeret = system(string_Script.c_str());
-		char* temp_cmd = (char*)malloc(string_Script.length() + 1);
-		if(temp_cmd != NULL)
-		{
-			memset(temp_cmd, '\0', string_Script.length() +1 );
-			strncpy(temp_cmd, string_Script.c_str(), string_Script.length() );
-			exeret = system(temp_cmd);
-			free(temp_cmd);
-			temp_cmd = NULL;
-		}
-	}
-
-	std::string string_Script2;
-	if(exeret == 0)
-	{
-		string_Script2.append("rm -f ");
-		string_Script2.append(strModuleFileName);
-		string_Script2.append(".lck ");
-		string_Script2.append(strModuleFileName);
-		string_Script2.append(".c ");
-		/*		string_Script2.append(strModuleFileName);
-		string_Script2.append(".lst ");*/
-		string_Script2.append(strModuleFileName);
-		string_Script2.append(".dep ");
-			//Solution 10-090915-4598 -- start
-		string_Script2.append(strModuleFileName);
-		string_Script2.append(".err ");
-
-		// Workaround for Solution 10-121212-5698
-		//exeret = system(string_Script2.c_str());
-		char* temp_cmd = (char*)malloc(string_Script2.length() + 1);
-		if(temp_cmd != NULL)
-		{
-			memset(temp_cmd, '\0', string_Script2.length() +1 );
-			strncpy(temp_cmd, string_Script2.c_str(), string_Script2.length() );
-			exeret = system(temp_cmd);
-			free(temp_cmd);
-			temp_cmd = NULL;
-		}
-	}
-	else
-	{
-		string_Script2.append("rm -f ");
-		string_Script2.append(strModuleFileName);
-		string_Script2.append(".c ");
-
-		/* string_Script2.append(strModuleFileName);
-		   string_Script2.append(".lst ");
-		*/
-		string_Script2.append(strModuleFileName);
-		string_Script2.append(".dep ");
-		/* string_Script2.append(strModuleFileName);
-		string_Script2.append(".sql");
-		*/
-		
-		// Workaround for Solution 10-121212-5698
-		//exeret = system(string_Script2.c_str());
-		char* temp_cmd = (char*)malloc(string_Script2.length() + 1);
-		if(temp_cmd != NULL)
-		{
-			memset(temp_cmd, '\0', string_Script2.length() +1 );
-			strncpy(temp_cmd, string_Script2.c_str(), string_Script2.length() );
-			exeret = system(temp_cmd);
-			free(temp_cmd);
-			temp_cmd = NULL;
-		}
-	}
-}
-
 SQLRETURN COMMIT_ROWSET(long dialogueId, bool& bSQLMessageSet, odbc_SQLSvc_SQLError* SQLError, Int32 currentRowCount)
 {
     SQLRETURN retcode;
diff --git a/core/conn/jdbc_type2/native/SqlInterface.h b/core/conn/jdbc_type2/native/SqlInterface.h
index 857cfcf..b543ea0 100644
--- a/core/conn/jdbc_type2/native/SqlInterface.h
+++ b/core/conn/jdbc_type2/native/SqlInterface.h
@@ -62,8 +62,6 @@
 
 extern SQLRETURN CLEARDIAGNOSTICS(SRVR_STMT_HDL *pSrvrStmt);
 
-extern SQLRETURN PREPARE_FROM_MODULE(SRVR_STMT_HDL* pSrvrStmt);
-
 extern SQLRETURN ALLOCSQLMXHDLS(SRVR_STMT_HDL *pSrvrStmt);
 
 extern SQLRETURN ALLOCSQLMXHDLS_SPJRS(SRVR_STMT_HDL *pSrvrStmt, SQLSTMT_ID *callpStmt, const char *RSstmtName);
@@ -84,47 +82,4 @@
 
 SQLRETURN _SQL_Wait (SRVR_STMT_HDL *pSrvrStmt, long int *retcode );
 
-extern SQLRETURN PREPAREFORMFC(SRVR_STMT_HDL* pSrvrStmt); // New method for MFC - PREPARE + createModule
-
-
-//MFC  New structure and methods to get datatypes from descriptors
-typedef struct InputDescInfo {
-	int CountPosition;
-	long DataType;
-	char DataTypeString[50];
-	long Length;
-	long DateTimeCode;
-	long Precision;
-	long SQLCharset;
-	long ODBCPrecision;
-	long ODBCDataType;
-	long Scale;
-	long Nullable;
-	long IntLeadPrec;
-
-	void setData(int countPosition, long dataType, long length, long scale,long Nullable,
-		long dateTimeCode, long precision,long IntLeadPrec, long sQLCharset, SRVR_GLOBAL_Def *srvrGlobal);
-
-
-
-
-	InputDescInfo();
-
-
-	~InputDescInfo();
-
-	InputDescInfo(const InputDescInfo &rval);
-
-
-	void operator = (const InputDescInfo &rval);
-
-};
-
-SQLRETURN BuildSQLDesc2ForModFile(SQLDESC_ID pDesc,long numEntries,InputDescInfo *&pInputDescInfo);
-
-SQLRETURN BuildSQLDesc(SRVR_STMT_HDL*pSrvrStmt, SRVR_STMT_HDL::DESC_TYPE descType,InputDescInfo *pInputDescInfo);
-void CreateModulePlan(long inputParamCount, InputDescInfo *inputDescInfo, char *inputsqlString,long dialogueId,const char *resMD5);
-
-
-
 #endif
diff --git a/core/conn/jdbc_type2/native/SrvrCommon.cpp b/core/conn/jdbc_type2/native/SrvrCommon.cpp
index 8db4032..f463a0d 100644
--- a/core/conn/jdbc_type2/native/SrvrCommon.cpp
+++ b/core/conn/jdbc_type2/native/SrvrCommon.cpp
@@ -485,58 +485,6 @@
     FUNCTION_RETURN_PTR(pSrvrStmt,("sqlcode=%s",CliDebugSqlError(*sqlcode)));
 }
 
-
-SRVR_STMT_HDL *createSrvrStmtForMFC(
-                                    long dialogueId,
-                                    const char *stmtLabel,
-                                    long    *sqlcode,
-                                    const char *moduleName,
-                                    long moduleVersion,
-                                    long long moduleTimestamp,
-                                    short   sqlStmtType,
-                                    BOOL    useDefaultDesc)
-{
-    FUNCTION_ENTRY("createSrvrStmt",(""));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  dialogueId=%ld, stmtLabel=%s",
-        dialogueId,
-        DebugString(stmtLabel)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  sqlcode=0x%08x",
-        sqlcode));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  moduleName=%s",
-        DebugString(moduleName)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  moduleVersion=%ld, moduleTimestamp=%s",
-        moduleVersion,
-        DebugTimestampStr(moduleTimestamp)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  sqlStmtType=%s, useDefaultDesc=%d",
-        CliDebugSqlStatementType(sqlStmtType),
-        useDefaultDesc));
-
-    SQLRETURN rc;
-    SRVR_CONNECT_HDL *pConnect;
-    SRVR_STMT_HDL *pSrvrStmt;
-
-    if (dialogueId == 0)
-    {
-        *sqlcode = DIALOGUE_ID_NULL_ERROR;
-        FUNCTION_RETURN_PTR(NULL,("sqlcode=%s",CliDebugSqlError(*sqlcode)));
-    }
-    pConnect = (SRVR_CONNECT_HDL *)dialogueId;
-    rc = pConnect->switchContext(sqlcode);
-    switch (rc)
-    {
-    case SQL_SUCCESS:
-    case SQL_SUCCESS_WITH_INFO:
-        break;
-    default:
-        FUNCTION_RETURN_PTR(NULL,("sqlcode=%s",CliDebugSqlError(*sqlcode)));
-    }
-
-    pSrvrStmt = pConnect->createSrvrStmtForMFC(stmtLabel, sqlcode, moduleName, moduleVersion, moduleTimestamp,
-        sqlStmtType, useDefaultDesc);
-    FUNCTION_RETURN_PTR(pSrvrStmt,("sqlcode=%s",CliDebugSqlError(*sqlcode)));
-}
-
-
 SRVR_STMT_HDL *createSpjrsSrvrStmt(SRVR_STMT_HDL *callpSrvrStmt,
                                    long dialogueId,
                                    const char *stmtLabel,
@@ -1099,9 +1047,9 @@
     long                sqlcode;
     short               holdability;
     long                queryTimeout;
-    odbc_SQLSvc_SQLError ModuleError;
+    odbc_SQLSvc_SQLError sqlError;
     char *odbcAppVersion = "3";
-    CLEAR_ERROR(ModuleError);
+    CLEAR_ERROR(sqlError);
 
     char catalogNmNoEsc[MAX_ANSI_NAME_LEN+1];
     char schemaNmNoEsc[MAX_ANSI_NAME_LEN+1];
@@ -1708,17 +1656,17 @@
             }
     if (pSrvrStmt == NULL)
     {
-        executeException->exception_nr = odbc_SQLSvc_PrepareFromModule_SQLError_exn_;
-        kdsCreateSQLErrorException(&ModuleError, 1);
-        kdsCopySQLErrorException(&ModuleError, SQLSVC_EXCEPTION_READING_FROM_MODULE_FAILED, sqlcode,
+        executeException->exception_nr = odbc_SQLSvc_Prepare_SQLError_exn_;
+        kdsCreateSQLErrorException(&sqlError, 1);
+        kdsCopySQLErrorException(&sqlError, SQLSVC_EXCEPTION_PREPARE_FAILED, sqlcode,
             "HY000");
-        executeException->u.SQLError.errorList._length = ModuleError.errorList._length;
-        executeException->u.SQLError.errorList._buffer = ModuleError.errorList._buffer;
+        executeException->u.SQLError.errorList._length = sqlError.errorList._length;
+        executeException->u.SQLError.errorList._buffer = sqlError.errorList._buffer;
         FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION"));
     }
     //make pSrvrStmt->Prepare() happy
     sqlString->dataValue._length=strlen((const char*)sqlString->dataValue._buffer);
-    rc = pSrvrStmt->Prepare(sqlString, sqlStmtType, holdability, queryTimeout,false);
+    rc = pSrvrStmt->Prepare(sqlString, sqlStmtType, holdability, queryTimeout);
     if (rc == SQL_ERROR)
     {
         executeException->exception_nr = odbc_SQLSvc_ExecuteN_SQLError_exn_;
@@ -2014,251 +1962,6 @@
     FUNCTION_RETURN_NUMERIC(CEE_SUCCESS,("CEE_SUCCESS"));
 }
 
-short do_ExecFetchAppend(
-                         /* In    */ void *objtag_
-                         , /* In    */ const CEE_handle_def *call_id_
-                         , /* Out   */ ExceptionStruct *executeException
-                         , /* Out   */ ERROR_DESC_LIST_def *sqlWarning
-                         , /* In    */ long dialogueId
-                         , /* In    */ const char *stmtLabel
-                         , /* In    */ short sqlStmtType
-                         , /* In    */ char *tableParam[]
-, /* In    */ const char *inputParam[]
-, /* Out   */ SQLItemDescList_def *outputDesc
-, /* Out   */ long *rowsAffected
-, /* Out   */ SQLValueList_def *outputValueList
-, /* Out   */ long *stmtId
-)
-{
-    FUNCTION_ENTRY("do_ExecFetchAppend",("objtag_=%ld, call_id_=0x%08x, executeException=0x%08x, sqlWarning=0x%08x, dialogueId=%ld, stmtLabel=%s, sqlStmtType=%s, tableParam=0x%08x, inputParam=0x%08x, outputDesc=0x%08x, stmtId=0x%08x",
-        objtag_,
-        call_id_,
-        executeException,
-        sqlWarning,
-        dialogueId,
-        DebugString(stmtLabel),
-        CliDebugSqlStatementType(sqlStmtType),
-        tableParam,
-        inputParam,
-        outputDesc,
-        stmtId));
-
-    SRVR_STMT_HDL       *pSrvrStmt;
-    SQLItemDesc_def     *SQLItemDesc;
-    SMD_QUERY_TABLE     *smdQueryTable;     // Linux port - Commenting for now
-    unsigned long       curParamNo;
-    //long              allocLength;
-    int             allocLength;
-    long                retcode;
-    SQLRETURN           rc;
-    short               indValue;
-    BOOL                tableParamDone;
-    unsigned long       index;
-    long                sqlcode;
-    odbc_SQLSvc_SQLError ModuleError;
-    CLEAR_ERROR(ModuleError);
-
-    SQLValueList_def    tempOutputValueList;    // temp buffer for combined data
-    CLEAR_LIST(tempOutputValueList);
-
-    long                totalLength=0;
-
-    // Setup module filenames for MX metadata
-    pSrvrStmt = createSrvrStmt(dialogueId,
-        stmtLabel,
-        &sqlcode,
-        NULL,
-        SQLCLI_ODBC_MODULE_VERSION,
-        1234567890,
-        sqlStmtType,
-        false,true);
-
-    if (pSrvrStmt == NULL){
-        executeException->exception_nr = odbc_SQLSvc_PrepareFromModule_SQLError_exn_;
-        kdsCreateSQLErrorException(&ModuleError, 1);
-        kdsCopySQLErrorException(&ModuleError, SQLSVC_EXCEPTION_READING_FROM_MODULE_FAILED, sqlcode,
-            "HY000");
-        executeException->u.SQLError.errorList._length = ModuleError.errorList._length;
-        executeException->u.SQLError.errorList._buffer = ModuleError.errorList._buffer;
-        FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION"));
-    }
-
-    rc = pSrvrStmt->PrepareFromModule(INTERNAL_STMT);
-    *stmtId = (long)pSrvrStmt;
-    if (rc == SQL_ERROR)
-    {
-        executeException->exception_nr = odbc_SQLSvc_ExecuteN_SQLError_exn_;
-        executeException->u.SQLError.errorList._length = pSrvrStmt->sqlError.errorList._length;
-        executeException->u.SQLError.errorList._buffer = pSrvrStmt->sqlError.errorList._buffer;
-        FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION"));
-    }
-
-#ifndef _FASTPATH
-    if ((rc = AllocAssignValueBuffer(&pSrvrStmt->inputDescList,
-        &pSrvrStmt->inputValueList, pSrvrStmt->inputDescVarBufferLen, 1,
-        pSrvrStmt->inputValueVarBuffer)) != SQL_SUCCESS)
-    {
-        executeException->exception_nr = odbc_SQLSvc_ExecuteN_ParamError_exn_;
-        executeException->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_BUFFER_ALLOC_FAILED;
-        FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION"));
-    }
-#endif
-    pSrvrStmt->InternalStmtClose(SQL_CLOSE);
-    outputDesc->_length = pSrvrStmt->outputDescList._length;
-    outputDesc->_buffer = pSrvrStmt->outputDescList._buffer;
-
-#ifdef _FASTPATH
-
-    SRVR_DESC_HDL   *IPD;
-    IPD = pSrvrStmt->IPD;
-    BYTE    *dataPtr;
-    BYTE    *indPtr;
-    long    dataType;
-
-    // Populate the prepared module statement with the tableParam and inputParam lists
-    for (curParamNo = 0, index = 0,  tableParamDone = FALSE;
-        curParamNo < pSrvrStmt->inputDescList._length ; curParamNo++, index++)
-    {
-        dataPtr = IPD[curParamNo].varPtr;
-        indPtr = IPD[curParamNo].indPtr;
-        dataType = IPD[curParamNo].dataType;
-        SQLItemDesc = (SQLItemDesc_def *)pSrvrStmt->inputDescList._buffer + curParamNo;
-        getMemoryAllocInfo(SQLItemDesc->dataType, SQLItemDesc->SQLCharset, SQLItemDesc->maxLen, SQLItemDesc->vc_ind_length, 0,
-            NULL, &allocLength, NULL);
-        if (! tableParamDone)
-        {
-            if (tableParam[index] == NULL)
-            {
-                tableParamDone = TRUE;
-                index = 0;
-            }
-            else
-            {
-                retcode = setParamValue(dataType, dataPtr, indPtr, allocLength, tableParam[index]);
-                DEBUG_OUT(DEBUG_LEVEL_METADATA,("tableParam[%d] = %s ",index,tableParam[index]));
-            }
-        }
-        if (tableParamDone)
-        {
-            retcode = setParamValue(dataType, dataPtr, indPtr, allocLength, inputParam[index]);
-            DEBUG_OUT(DEBUG_LEVEL_METADATA,("inputParam[%d] = %s ",index,inputParam[index]));
-        }
-        if (retcode != 0)
-            FUNCTION_RETURN_NUMERIC((short) retcode,(NULL));
-    }
-#else
-    for (curParamNo = 0, index = 0, tableParamDone = FALSE, pSrvrStmt->inputValueList._length = 0;
-        curParamNo < pSrvrStmt->inputDescList._length ; curParamNo++, index++)
-    {
-        SQLItemDesc = (SQLItemDesc_def *)pSrvrStmt->inputDescList._buffer + curParamNo;
-        getMemoryAllocInfo(SQLItemDesc->dataType, SQLItemDesc->SQLCharset, SQLItemDesc->maxLen, SQLItemDesc->vc_ind_length, 0,
-            NULL, &allocLength, NULL);
-        if (! tableParamDone)
-        {
-            if (tableParam[index] == NULL)
-            {
-                tableParamDone = TRUE;
-                index = 0;
-            }
-            else
-            {
-                retcode = kdsCopyToSMDSQLValueSeq(&pSrvrStmt->inputValueList,
-                    SQLItemDesc->dataType, 0, tableParam[index], allocLength, SQLItemDesc->ODBCCharset);
-            }
-        }
-        if (tableParamDone)
-        {
-            if  (inputParam[index] == NULL)
-                indValue = -1;
-            else
-                indValue = 0;
-            retcode = kdsCopyToSMDSQLValueSeq(&pSrvrStmt->inputValueList,
-                SQLItemDesc->dataType, indValue, inputParam[index], allocLength, SQLItemDesc->ODBCCharset);
-        }
-        if (retcode != 0)
-            FUNCTION_RETURN_NUMERIC((short) retcode,(NULL));
-    }
-#endif
-    executeException->exception_nr = 0;
-
-    // sqlStmtType has value of types like TYPE_SELECT, TYPE_DELETE etc.
-    odbc_SQLSvc_ExecuteN_sme_(objtag_, call_id_, executeException, dialogueId, *stmtId,
-        (char *)stmtLabel,
-        sqlStmtType, 1, &pSrvrStmt->inputValueList, SQL_ASYNC_ENABLE_OFF, 0,
-        &pSrvrStmt->outputValueList, sqlWarning);
-
-    if (executeException->exception_nr != CEE_SUCCESS) {
-        FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION"));
-    }
-
-    if ((pSrvrStmt = getSrvrStmt(dialogueId, *stmtId, &sqlcode)) == NULL)
-    {
-        executeException->exception_nr = odbc_SQLSvc_FetchN_SQLInvalidHandle_exn_;
-        executeException->u.SQLInvalidHandle.sqlcode = sqlcode;
-        FUNCTION_RETURN_NUMERIC(-1, ("getSrvrStmt() Failed"));
-    }
-
-    do
-    {
-        rc = pSrvrStmt->Fetch(SQL_MAX_COLUMNS_IN_SELECT, SQL_ASYNC_ENABLE_OFF, 0);
-
-        switch (rc)
-        {
-        case SQL_SUCCESS:
-        case SQL_SUCCESS_WITH_INFO:
-            appendOutputValueList(outputValueList,&pSrvrStmt->outputValueList,false);
-
-            if (pSrvrStmt->outputValueList._length) *rowsAffected += pSrvrStmt->rowsAffected;
-            else *rowsAffected = pSrvrStmt->rowsAffected;
-
-            executeException->exception_nr = 0;
-
-            // Save off any warnings
-            if (pSrvrStmt->sqlWarning._length > 0)
-            {
-                sqlWarning->_length = pSrvrStmt->sqlWarning._length;
-                sqlWarning->_buffer = pSrvrStmt->sqlWarning._buffer;
-            }
-            break;
-        case SQL_STILL_EXECUTING:
-            executeException->exception_nr = odbc_SQLSvc_FetchN_SQLStillExecuting_exn_;
-            break;
-        case SQL_INVALID_HANDLE:
-            executeException->exception_nr = odbc_SQLSvc_FetchN_SQLInvalidHandle_exn_;
-            break;
-        case SQL_NO_DATA_FOUND:
-            executeException->exception_nr = odbc_SQLSvc_FetchN_SQLNoDataFound_exn_;
-            break;
-        case SQL_ERROR:
-            ERROR_DESC_def *error_desc_def;
-            error_desc_def = pSrvrStmt->sqlError.errorList._buffer;
-            if (pSrvrStmt->sqlError.errorList._length != 0 &&
-                (error_desc_def->sqlcode == -8007 || error_desc_def->sqlcode == -8007))
-            {
-                executeException->exception_nr = odbc_SQLSvc_FetchN_SQLQueryCancelled_exn_;
-                executeException->u.SQLQueryCancelled.sqlcode = error_desc_def->sqlcode;
-            }
-            else
-            {
-                executeException->exception_nr = odbc_SQLSvc_FetchN_SQLError_exn_;
-                executeException->u.SQLError.errorList._length = pSrvrStmt->sqlError.errorList._length;
-                executeException->u.SQLError.errorList._buffer = pSrvrStmt->sqlError.errorList._buffer;
-            }
-            break;
-        case PROGRAM_ERROR:
-            executeException->exception_nr = odbc_SQLSvc_FetchN_ParamError_exn_;
-            executeException->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_FETCH_FAILED;
-        default:
-            break;
-        }
-
-        // Loop until we have no more rows
-    } while (((rc==SQL_SUCCESS) || (rc==SQL_SUCCESS_WITH_INFO)) &&
-        (pSrvrStmt->rowsAffected==SQL_MAX_COLUMNS_IN_SELECT));
-
-    FUNCTION_RETURN_NUMERIC(0,(NULL));
-}
-
 BOOL nullRequired(long charSet)
 {
     FUNCTION_ENTRY("nullRequired", ("charSet = %s", getCharsetEncoding(charSet)));
diff --git a/core/conn/jdbc_type2/native/SrvrCommon.h b/core/conn/jdbc_type2/native/SrvrCommon.h
index fcfe205..906e362 100644
--- a/core/conn/jdbc_type2/native/SrvrCommon.h
+++ b/core/conn/jdbc_type2/native/SrvrCommon.h
@@ -30,9 +30,6 @@
 #include "CoreCommon.h"
 //#include "eventMsgs.h"
 
-#define MFCKEY  "T2MFC"  // MFC
-
-
 #define CLEAR_EXCEPTION(exception) { \
     exception.exception_nr = 0; \
     exception.exception_detail = 0; \
@@ -126,15 +123,6 @@
 									 Int32  resultSetIndex = 0,
 									 SQLSTMT_ID* callStmtId = NULL);
 
-extern SRVR_STMT_HDL *createSrvrStmtForMFC(long dialogueId,
-                                           const char *stmtLabel,
-                                           long *sqlcode = NULL,
-                                           const char *moduleName = NULL,
-                                           long moduleVersion = SQLCLI_ODBC_MODULE_VERSION,
-                                           long long moduleTimestamp = 0,
-                                           short sqlStmtType = TYPE_UNKNOWN,
-                                           BOOL useDefaultDesc = FALSE
-                                           );
 extern SRVR_STMT_HDL *createSpjrsSrvrStmt(SRVR_STMT_HDL *callpStmt,
                                           long dialogueId,
                                           const char *RSstmtLabel,
@@ -261,22 +249,6 @@
 , /* Out   */ long *stmtId
 );
 
-extern short do_ExecFetchAppend(
-                                /* In    */ void * objtag_
-                                , /* In    */ const CEE_handle_def *call_id_
-                                , /* Out   */ ExceptionStruct *executeException
-                                , /* Out   */ ERROR_DESC_LIST_def *sqlWarning
-                                , /* In    */ long dialogueId
-                                , /* In    */ const char *stmtLabel
-                                , /* In    */ short sqlStmtType
-                                , /* In    */ char *tableParam[]
-, /* In    */ const char *inputParam[]
-, /* Out   */ SQLItemDescList_def *outputDesc
-, /* Out   */ long *rowsAffected
-, /* Out   */ SQLValueList_def *outputValueList
-, /* Out   */ long *stmtId
-);
-
 extern "C" void 
 GETMXCSWARNINGORERROR(
         /* In    */ Int32 sqlcode
diff --git a/core/conn/jdbc_type2/native/SrvrOthers.cpp b/core/conn/jdbc_type2/native/SrvrOthers.cpp
index 25b6065..828ee13 100644
--- a/core/conn/jdbc_type2/native/SrvrOthers.cpp
+++ b/core/conn/jdbc_type2/native/SrvrOthers.cpp
@@ -93,9 +93,7 @@
                          SQLItemDescList_def      *outputDesc,      /* Out  */
                          ERROR_DESC_LIST_def      *sqlWarning,      /* Out  */
                          long                     *stmtId,          /* Out  */
-                         long                 *inputParamOffset,     /* Out   */
-                         char                 *moduleName,
-                         bool isISUD)
+                         long                 *inputParamOffset)     /* Out   */
 
 {
     FUNCTION_ENTRY_LEVEL(DEBUG_LEVEL_STMT, "odbc_SQLSvc_Prepare_sme_",(""));
@@ -174,14 +172,7 @@
     if (rc==SQL_SUCCESS){
     //Start Soln no:10-091103-5969
         jboolean stmtType_ = getSqlStmtType(sqlString->dataValue._buffer);
-        if(stmtType_ == JNI_TRUE && batchSize > 0 || srvrGlobal->moduleCaching == 0)
-        {
-            rc = pSrvrStmt->Prepare(sqlString, stmtType, holdability, queryTimeout,isISUD);
-        }
-        else
-        {
-            rc = pSrvrStmt->PrepareforMFC(sqlString, stmtType, holdability, queryTimeout,isISUD);
-        }
+        rc = pSrvrStmt->Prepare(sqlString, stmtType, holdability, queryTimeout);
     //End Soln no:10-091103-5969
     }
 
@@ -1196,14 +1187,6 @@
         // Set default schema to null
         pConnect->DefaultSchema[0] =  '\0';
         break;
-        // MFC option to set recompilation warnings on
-    case SQL_RECOMPILE_WARNING:
-        strcpy(sqlString, "CONTROL QUERY DEFAULT RECOMPILATION_WARNINGS 'ON'");
-        break;
-        // MFC support for BigNum
-    case SET_SESSION_INTERNAL_IO:
-        strcpy(sqlString, "SET SESSION DEFAULT internal_format_io 'on'");
-        break;
     default:
         exception_->exception_nr = odbc_SQLSvc_SetConnectionOption_ParamError_exn_;
         exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_INVALID_CONNECTION_OPTION;
@@ -1253,115 +1236,6 @@
 
 /*
 * Synchronous method function prototype for
-* operation 'odbc_SQLSvc_PrepareFromModule'
-*/
-extern "C" void
-odbc_SQLSvc_PrepareFromModule_sme_(
-                                   /* In    */ void * objtag_
-                                   , /* In  */ const CEE_handle_def *call_id_
-                                   , /* Out   */ ExceptionStruct *exception_
-                                   , /* In  */ long dialogueId
-                                   , /* In  */ char *moduleName
-                                   , /* In  */ long moduleVersion
-                                   , /* In  */ long long moduleTimestamp
-                                   , /* In  */ char *stmtName
-                                   , /* In  */ short sqlStmtType
-                                   , /* In  */ long fetchSize
-                                   ,/* In   */ long batchSize
-                                   , /* In   */ long holdability
-                                   , /* Out   */ long *estimatedCost
-                                   , /* Out   */ SQLItemDescList_def *inputDesc
-                                   , /* Out   */ SQLItemDescList_def *outputDesc
-                                   , /* Out   */ ERROR_DESC_LIST_def *sqlWarning
-                                   , /* Out   */ long *stmtId
-                                   , /* Out   */ long *inputParamOffset
-                                   )
-{
-    FUNCTION_ENTRY("odbc_SQLSvc_PrepareFromModule_sme_",("... fetchSize=%ld, inputParamOffset=%ld",
-        fetchSize,
-        inputParamOffset));
-
-    SRVR_STMT_HDL *pSrvrStmt;
-    SQLRETURN rc;
-    ERROR_DESC_def error_desc;
-    long    sqlcode;
-
-    odbc_SQLSvc_SQLError ModuleError;
-    CLEAR_ERROR(ModuleError);
-
-    // Need to validate the stmtLabel
-    // Given a label find out the SRVR_STMT_HDL
-    if ((pSrvrStmt = createSrvrStmtForMFC(dialogueId, stmtName, &sqlcode, moduleName,
-        moduleVersion, moduleTimestamp, sqlStmtType, TRUE)) == NULL)
-    {
-        exception_->exception_nr = odbc_SQLSvc_PrepareFromModule_SQLError_exn_;
-        kdsCreateSQLErrorException(&ModuleError, 1);
-        kdsCopySQLErrorException(&ModuleError, SQLSVC_EXCEPTION_READING_FROM_MODULE_FAILED, sqlcode,
-            "HY000");
-        exception_->u.SQLError.errorList._length = ModuleError.errorList._length;
-        exception_->u.SQLError.errorList._buffer = ModuleError.errorList._buffer;
-        FUNCTION_RETURN_VOID(("createSrvrStmt() Failed"));
-    }
-
-    // Setup the output descriptors using the fetch size
-    pSrvrStmt->holdability = holdability;
-    pSrvrStmt->resetFetchSize(fetchSize);
-
-    rc = pSrvrStmt->setMaxBatchSize(batchSize);
-
-    // Prepare the statement
-    if(rc == SQL_SUCCESS)
-    {
-        rc = pSrvrStmt->PrepareFromModule(EXTERNAL_STMT);
-    }
-
-    switch (rc)
-    {
-    case SQL_SUCCESS:
-    case SQL_SUCCESS_WITH_INFO:
-        exception_->exception_nr = 0;
-        // Copy all the output parameters
-        *estimatedCost = pSrvrStmt->estimatedCost;
-        inputDesc->_length = pSrvrStmt->inputDescList._length;
-        inputDesc->_buffer = pSrvrStmt->inputDescList._buffer;
-        outputDesc->_length = pSrvrStmt->outputDescList._length;
-        outputDesc->_buffer = pSrvrStmt->outputDescList._buffer;
-        sqlWarning->_length = pSrvrStmt->sqlWarning._length;
-        sqlWarning->_buffer = pSrvrStmt->sqlWarning._buffer;
-        *stmtId = (long)pSrvrStmt;
-        *inputParamOffset = pSrvrStmt->inputDescParamOffset;
-        break;
-    case SQL_STILL_EXECUTING:
-        exception_->exception_nr = odbc_SQLSvc_PrepareFromModule_SQLStillExecuting_exn_;
-        break;
-    case ODBC_RG_ERROR:
-    case SQL_ERROR:
-        ERROR_DESC_def *error_desc_def;
-        error_desc_def = pSrvrStmt->sqlError.errorList._buffer;
-        if (pSrvrStmt->sqlError.errorList._length != 0 &&
-            (error_desc_def->sqlcode == -8007 || error_desc_def->sqlcode == -8007))
-        {
-            exception_->exception_nr = odbc_SQLSvc_PrepareFromModule_SQLQueryCancelled_exn_;
-            exception_->u.SQLQueryCancelled.sqlcode = error_desc_def->sqlcode;
-        }
-        else
-        {
-            exception_->exception_nr = odbc_SQLSvc_PrepareFromModule_SQLError_exn_;
-            exception_->u.SQLError.errorList._length = pSrvrStmt->sqlError.errorList._length;
-            exception_->u.SQLError.errorList._buffer = pSrvrStmt->sqlError.errorList._buffer;
-        }
-        break;
-    case PROGRAM_ERROR:
-        exception_->exception_nr = odbc_SQLSvc_PrepareFromModule_ParamError_exn_;
-        exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_PREPARE_FAILED;
-    default:
-        break;
-    }
-    FUNCTION_RETURN_VOID((NULL));
-}
-
-/*
-* Synchronous method function prototype for
 * operation 'odbc_SQLSvc_ExecuteCall'
 */
 extern "C" void
diff --git a/core/conn/jdbc_type2/native/SrvrOthers.h b/core/conn/jdbc_type2/native/SrvrOthers.h
index e78e563..c416786 100644
--- a/core/conn/jdbc_type2/native/SrvrOthers.h
+++ b/core/conn/jdbc_type2/native/SrvrOthers.h
@@ -41,7 +41,6 @@
 #define odbc_SQLSvc_FetchN_SQLStillExecuting_exn_ 6
 #define odbc_SQLSvc_FetchN_SQLQueryCancelled_exn_ 7
 #define odbc_SQLSvc_FetchN_TransactionError_exn_ 8
-#define SQL_RECOMPILE_WARNING			113		// MFC - definition for recompilation warnings
 
 extern "C" void
 odbc_SQLSvc_FetchN_sme_(
@@ -120,10 +119,7 @@
 						 SQLItemDescList_def      *outputDesc,		/* Out  */
 						 ERROR_DESC_LIST_def      *sqlWarning,		/* Out  */
 						 long                     *stmtId,			/* Out  */
-						 long                 *inputParamOffset,	/* Out   */
-						 char                *moduleName,
-						 bool isISUD
-						 );
+						 long                 *inputParamOffset);    	/* Out   */
 
 
 /*
@@ -266,39 +262,6 @@
 
 /*
 * Exception number constants for
-* operation 'odbc_SQLSvc_PrepareFromModule'
-*/
-#define odbc_SQLSvc_PrepareFromModule_ParamError_exn_ 1
-#define odbc_SQLSvc_PrepareFromModule_InvalidConnection_exn_ 2
-#define odbc_SQLSvc_PrepareFromModule_SQLError_exn_ 3
-#define odbc_SQLSvc_PrepareFromModule_SQLStillExecuting_exn_ 4
-#define odbc_SQLSvc_PrepareFromModule_SQLQueryCancelled_exn_ 5
-#define odbc_SQLSvc_PrepareFromModule_TransactionError_exn_ 6
-
-extern "C" void
-odbc_SQLSvc_PrepareFromModule_sme_(
-								   /* In	*/ void * objtag_
-								   , /* In	*/ const CEE_handle_def *call_id_
-								   , /* Out   */ ExceptionStruct *exception_
-								   , /* In	*/ long dialogueId
-								   , /* In	*/ char *moduleName
-								   , /* In	*/ long moduleVersion
-								   , /* In	*/ long long moduleTimestamp
-								   , /* In	*/ char *stmtName
-								   , /* In	*/ short sqlStmtType
-								   , /* In	*/ long fetchSize
-								   , /* In   */ long batchSize
-								   , /* In   */ long holdability
-								   , /* Out   */ long *estimatedCost
-								   , /* Out   */ SQLItemDescList_def *inputDesc
-								   , /* Out   */ SQLItemDescList_def *outputDesc
-								   , /* Out   */ ERROR_DESC_LIST_def *sqlWarning
-								   , /* Out   */ long *stmtId
-								   , /* Out   */ long *inputParamOffset
-								   );
-
-/*
-* Exception number constants for
 * operation 'odbc_SQLSvc_ExecuteCall'
 */
 #define odbc_SQLSvc_ExecuteCall_ParamError_exn_ 1
@@ -461,4 +424,3 @@
 //extern std::map<std::string, std::string> mapOfSQLToModuleFile;
 
 #endif // _SRVROTHERS_DEFINED
-# define SET_SESSION_INTERNAL_IO 197  //MFC support for BigNum
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/PreparedStatementManager.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/PreparedStatementManager.java
index 39648af..c67b1fb 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/PreparedStatementManager.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/PreparedStatementManager.java
@@ -329,8 +329,6 @@
 				lookupKey = lookupKey.concat(connect.schema_);			
 			lookupKey = lookupKey.concat(String.valueOf(connect.transactionIsolation_))
 					.concat(String.valueOf(resultSetHoldability));
-			if (connect.getMD5HashCode() != null) 
-				lookupKey = lookupKey.concat(connect.getMD5HashCode());
 //			lookupKey = sql;
 //			if (connect.catalog_ != null)
 //				lookupKey.concat(connect.catalog_);
@@ -403,8 +401,6 @@
 				lookupKey = lookupKey.concat(connect.schema_);
 			lookupKey = lookupKey.concat(String.valueOf(connect.transactionIsolation_))
 					.concat(String.valueOf(resultSetHoldability));
-			if (connect.getMD5HashCode() != null) 
-				lookupKey = lookupKey.concat(connect.getMD5HashCode());
 //			lookupKey = sql;
 //			if (connect.catalog_ != null)
 //				lookupKey.concat(connect.catalog_);
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXCallableStatement.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXCallableStatement.java
index d28fbc5..0208991 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXCallableStatement.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXCallableStatement.java
@@ -1550,32 +1550,8 @@
         }
     }
 
-    void cpqPrepareCall(String server, long dialogueId, int txid,
-            boolean autoCommit, String moduleName, int moduleVersion,
-            long moduleTimestamp, String stmtName, int queryTimeout,
-            int holdability) {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_cpqPrepareCall].methodEntry();
-        try {
-            /*
-             * RFE: Connection synchronization Connection object is now
-             * synchronized.
-             */
-            synchronized (connection_) {
-                // Call adding the current fetch size and select flag
-                cpqPrepareCall(server, dialogueId, txid, autoCommit,
-                        connection_.transactionMode_, moduleName,
-                        moduleVersion, moduleTimestamp, stmtName, queryTimeout,
-                        holdability, fetchSize_);
-            } // End sync
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_cpqPrepareCall].methodExit();
-        }
-    }
-
     // Other methods
-protected void validateGetInvocation(int parameterIndex)
+    protected void validateGetInvocation(int parameterIndex)
     throws SQLException {
         if (JdbcDebugCfg.entryActive)
         debug[methodId_validateGetInvocation_I].methodEntry();
@@ -1719,13 +1695,6 @@
             boolean autoCommit, int txnMode, long stmtId, int inputParamCount,
             Object inputParamValues, int queryTimeout, String iso88591Encoding);
 
-    // This method is used for internal support of SQLJ.
-    // Not used directly by SQLJ, so can be modified.
-    native void cpqPrepareCall(String server, long dialogueId, int txid,
-            boolean autoCommit, int txnMode, String moduleName,
-            int moduleVersion, long moduleTimestamp, String stmtName,
-            int queryTimeout, int holdability, int fetchSize);
-
     // fields
     boolean wasNull_;
     short returnResultSet_;
@@ -1813,19 +1782,18 @@
 private static int methodId_executeBatch = 79;
 private static int methodId_executeQuery = 80;
 private static int methodId_executeUpdate = 81;
-private static int methodId_cpqPrepareCall = 82;
-private static int methodId_validateGetInvocation_I = 83;
-private static int methodId_validateGetInvocation_L = 84;
-private static int methodId_validateSetInvocation = 85;
-private static int methodId_setExecuteCallOutputs = 86;
-private static int methodId_setByte = 87;
-private static int methodId_setBytes = 88;
-private static int methodId_setCharacterStream = 89;
-private static int methodId_SQLMXCallableStatement_LL = 90;
-private static int methodId_SQLMXCallableStatement_LLII = 91;
-private static int methodId_SQLMXCallableStatement_LLIII = 92;
-private static int methodId_SQLMXCallableStatement_LLIJL = 93;
-private static int totalMethodIds = 94;
+private static int methodId_validateGetInvocation_I = 82;
+private static int methodId_validateGetInvocation_L = 83;
+private static int methodId_validateSetInvocation = 84;
+private static int methodId_setExecuteCallOutputs = 85;
+private static int methodId_setByte = 86;
+private static int methodId_setBytes = 87;
+private static int methodId_setCharacterStream = 88;
+private static int methodId_SQLMXCallableStatement_LL = 89;
+private static int methodId_SQLMXCallableStatement_LLII = 90;
+private static int methodId_SQLMXCallableStatement_LLIII = 91;
+private static int methodId_SQLMXCallableStatement_LLIJL = 92;
+private static int totalMethodIds = 93;
 private static JdbcDebug[] debug;
 
     static {
@@ -1953,8 +1921,6 @@
                     "executeQuery");
             debug[methodId_executeUpdate] = new JdbcDebug(className,
                     "executeUpdate");
-            debug[methodId_cpqPrepareCall] = new JdbcDebug(className,
-                    "cpqPrepareCall");
             debug[methodId_validateGetInvocation_I] = new JdbcDebug(className,
                     "validateGetInvocation[I]");
             debug[methodId_validateGetInvocation_L] = new JdbcDebug(className,
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java
index 758a7b0..62739ef 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java
@@ -862,24 +862,10 @@
             }
 */
 
-            // MFC - if modulecaching is on call cpqprepare directly
-            // Renamed the modulecaching property as enableMFC
-            if (this.t2props.getEnableMFC().equalsIgnoreCase("on") && this.t2props.getBatchBinding() ==0) {
-
-                synchronized (SQLMXConnection.lockForMFCPrep) {
-                    pstmt.cpqPrepareJNI(server_, getDialogueId(), getTxid(),
-                            autoCommit_, transactionMode_, "", moduleVersion_,
-                            moduleTimestamp_, pstmt.getStmtLabel_(),
-                            pstmt.isSelect_, pstmt.queryTimeout_,
-                            pstmt.resultSetHoldability_, batchBindingSize_,
-                            pstmt.fetchSize_, sql.trim(),getSqlStmtTypeForMFC(sql.trim()));
-                }
-            } else {
-                pstmt.prepare(server_, getDialogueId(), getTxid(), autoCommit_,
+            pstmt.prepare(server_, getDialogueId(), getTxid(), autoCommit_,
                         pstmt.getStmtLabel_(), pstmt.sql_.trim(), pstmt.isSelect_,
                         pstmt.queryTimeout_, pstmt.resultSetHoldability_,
                         batchBindingSize_, pstmt.fetchSize_);
-            }
 
             // value
 //			if (SQLMXConnection.getSqlStmtType(sql) != SQLMXConnection.TYPE_INSERT
@@ -1050,25 +1036,11 @@
             }
 */
 
-            // MFC - if modulecaching is on call cpqprepare directly
-            // Renamed the modulecaching property as enableMFC
-            if (this.t2props.getEnableMFC().equalsIgnoreCase("on") && this.t2props.getBatchBinding() ==0) {
-
-                synchronized (SQLMXConnection.lockForMFCPrep) {
-                    stmt.cpqPrepareJNI(server_, getDialogueId(), getTxid(),
-                            autoCommit_, transactionMode_, "", moduleVersion_,
-                            moduleTimestamp_, stmt.getStmtLabel_(),
-                            stmt.isSelect_, stmt.queryTimeout_,
-                            stmt.resultSetHoldability_, batchBindingSize_,
-                            stmt.fetchSize_, sql.trim(),getSqlStmtTypeForMFC(sql.trim()));
-                }
-            } else {
                 stmt.prepare(server_, getDialogueId(), getTxid(),
                         autoCommit_, stmt.getStmtLabel_(), stmt.sql_.trim(),
                         stmt.isSelect_, stmt.queryTimeout_,
                         stmt.resultSetHoldability_, batchBindingSize_,
                         stmt.fetchSize_);
-            }
 /*
             if (stmt.getSqlType() != SQLMXConnection.TYPE_INSERT
                     && stmt.getSqlType() != SQLMXConnection.TYPE_INSERT_PARAM) {
@@ -1172,25 +1144,11 @@
             }
 
 */
-            // MFC - if modulecaching is on call cpqprepare directly
-            // Renamed the modulecaching property as enableMFC
-            if (this.t2props.getEnableMFC().equalsIgnoreCase("on") && this.t2props.getBatchBinding() ==0) {
-
-                synchronized (SQLMXConnection.lockForMFCPrep) {
-                    stmt.cpqPrepareJNI(server_, getDialogueId(), getTxid(),
-                            autoCommit_, transactionMode_, "", moduleVersion_,
-                            moduleTimestamp_, stmt.getStmtLabel_(),
-                            stmt.isSelect_, stmt.queryTimeout_,
-                            stmt.resultSetHoldability_, batchBindingSize_,
-                            stmt.fetchSize_, sql.trim(),getSqlStmtTypeForMFC(sql.trim()));
-                }
-            } else {
                 stmt.prepare(server_, getDialogueId(), getTxid(),
                         autoCommit_, stmt.getStmtLabel_(), stmt.sql_.trim(),
                         stmt.isSelect_, stmt.queryTimeout_,
                         stmt.resultSetHoldability_, batchBindingSize_,
                         stmt.fetchSize_);
-            }
 /*
 
             if (stmt.getSqlType() != SQLMXConnection.TYPE_INSERT
@@ -1760,13 +1718,10 @@
                             "ON")
                     || System.getProperty("cqdDoomUserTxn", "OFF")
                     .equalsIgnoreCase("ON");
-                    // MFC added two more parameters
-
                     connectInit(server_, getDialogueId(), catalog_, schema_,
                             mploc_, isReadOnly_, autoCommit_,
                             mapTxnIsolation(transactionIsolation_),
-                            loginTimeout_, queryTimeout_, enableMFC_,
-                            compiledModuleLocation_, blnCQD,
+                            loginTimeout_, queryTimeout_, blnCQD,
                             statisticsIntervalTime_, statisticsLimitTime_, statisticsType_, programStatisticsEnabled_, statisticsSqlPlanEnabled_
                     );
 
@@ -1940,31 +1895,6 @@
                     }
                     setTxid_(0);
                 }
-                if (this.setOfCQDs.isEmpty() == false) {
-                    if (clearCQD1 == null && clearCQD2 == null
-                            && clearCQD3 == null) {
-                        clearSetOfCQDs(this.getDialogueId());
-                        clearCQD2 = this
-                        .prepareForResetCQDs("CONTROL TABLE * RESET");
-                        clearSetOfCQDs(this.getDialogueId());
-                        clearCQD3 = this
-                        .prepareForResetCQDs("CONTROL QUERY SHAPE CUT");
-                        clearSetOfCQDs(this.getDialogueId());
-                        clearCQD1 = this
-                        .prepareForResetCQDs("CONTROL QUERY DEFAULT * RESET");
-
-                    }
-                    if (clearCQD1 != null) {
-                        clearCQD1.execute();
-                        clearCQD2.execute();
-                        clearCQD3.execute();
-                    }
-                    //native call to clear native cqd list
-                    clearSetOfCQDs(this.getDialogueId());
-                    this.setOfCQDs.clear();
-                    //to reset all the CQDs required for T2 connection.
-                    connectInitialized_ = false;
-                }
                 pc_.logicalClose(sendEvents);
                 isClosed_ = true;
             } else {
@@ -2165,28 +2095,6 @@
         }
     }
 
-    synchronized PreparedStatement prepareForResetCQDs(String sql)
-    throws SQLException {
-        try {
-            SQLMXPreparedStatement pstmt;
-            clearWarnings();
-            if (isClosed_)
-            throw Messages.createSQLException(locale_,
-                    "invalid_connection", null);
-            connectInit();
-            gcStmts();
-            pstmt = new SQLMXPreparedStatement(this, sql);
-            pstmt.prepare(server_, getDialogueId(), getTxid(), autoCommit_,
-                    pstmt.getStmtLabel_(), pstmt.sql_.trim(), pstmt.isSelect_,
-                    pstmt.queryTimeout_, pstmt.resultSetHoldability_,
-                    batchBindingSize_, pstmt.fetchSize_);
-            return pstmt;
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareStatement_L].methodExit();
-        }
-    }
-
     // Log the JDBC SQL statement and the STMTID to the idMapFile if the
     // enableLog_ property is set.
     private void printIdMapEntry(SQLMXStatement stmt) {
@@ -2372,39 +2280,6 @@
         }
     }
 
-    boolean getSqlStmtTypeForMFC(String str) {
-        //
-        // Kludge to determin if the type of statement.
-        //
-        String tokens[] = str.split("[^a-zA-Z]+", 3);
-        boolean isISUD = false;
-        String str3 = "";
-
-        //
-        // If there are no separators (i.e. no spaces, {, =, etc.) in front of
-        // the
-        // first token, then the first token is the key word we are looking for.
-        // Else, the first token is an empty string (i.e. split thinks the first
-        // token is the empty string followed by a separator), and the second
-        // token is the key word we are looking for.
-        //
-        if (tokens[0].length() > 0) {
-            str3 = tokens[0].toUpperCase();
-        } else {
-            str3 = tokens[1].toUpperCase();
-        }
-
-        if (str3.equals("SELECT") || str3.equals("UPDATE")
-                || str3.equals("DELETE") || str3.equals("INSERT")) {
-            isISUD = true;
-        } else {
-            isISUD = false;
-
-        }
-        return isISUD;
-
-    }
-
     static short getSqlStmtType(String str) {
         //
         // Kludge to determin if the type of statement.
@@ -2478,7 +2353,6 @@
 private native void connectInit(String server, long dialogueId,
             String catalog, String schema, String mploc, boolean isReadOnly, boolean autoCommit,
             int transactionIsolation, int loginTimeout, int queryTimeout,
-            String modulecaching, String compiledmodulelocation,
             boolean blnDoomUsrTxn,
             int statisticsIntervalTime_, int statisticsLimitTime_, String statisticsType_, String programStatisticsEnabled_, String statisticsSqlPlanEnabled_) throws SQLException;
 
@@ -2501,8 +2375,6 @@
     static native String getCharsetEncoding(String server, long dialogueId,
             int charset, String encodingOverride) throws SQLException;
 
-    //native method to clear all the CQD's and Control statement in setOFCQD() function
-private native void clearSetOfCQDs(long dialogueId);
     native void setCharsetEncodingOverride(String server, long dialogueId,
             int charset, String encodingOverride) throws SQLException;
 
@@ -2552,28 +2424,6 @@
         return out_;
     }
 
-public String getMD5HashCode() {
-
-        MessageDigest md5;
-        String hashCode = null;
-        try {
-            md5 = MessageDigest.getInstance("MD5");
-            if (!setOfCQDs.isEmpty()) {
-                Iterator itr = setOfCQDs.iterator();
-                while (itr.hasNext()) {
-                    String s = (String) itr.next();
-                    md5.update(s.getBytes());
-                }
-                BigInteger hash = new BigInteger(1, md5.digest());
-                hashCode = hash.toString(16);
-            }
-        } catch (NoSuchAlgorithmException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        return hashCode;
-    }
-
 public void initConnectionProps(T2Properties info) {
 
         dsn_ = info.getDataSourceName();
@@ -2597,8 +2447,6 @@
         batchBindingSize_ = info.getBatchBinding();
         connectionTimeout_ = 60;
         loginTimeout_ = info.getLoginTimeout();
-        enableMFC_ = info.getEnableMFC();
-        compiledModuleLocation_ = info.getCompiledModuleLocation();
         contBatchOnError_ = info.getContBatchOnError();
         iso88591EncodingOverride_ = info.getIso88591EncodingOverride();
 
@@ -2719,9 +2567,6 @@
     int batchBindingSize_;
     String contBatchOnError_;
     boolean contBatchOnErrorval_;
-    String enableMFC_;
-    String compiledModuleLocation_;
-
     WeakReference<SQLMXConnection> pRef_;
     SQLMXDataSource ds_;
     SQLMXPooledConnection pc_;
@@ -2782,29 +2627,27 @@
 private static int methodId_setSavepoint_V = 32;
 private static int methodId_setTransactionIsolation = 33;
 private static int methodId_setTypeMap = 34;
-private static int methodId_cpqPrepareStatement = 35;
-private static int methodId_cpqPrepareCall = 36;
-private static int methodId_begintransaction = 37;
-private static int methodId_mapTxnIsolation = 38;
-private static int methodId_gcStmts = 39;
-private static int methodId_removeElement_L = 40;
-private static int methodId_removeElement_V = 41;
-private static int methodId_addElement = 42;
-private static int methodId_connectInit = 43;
-private static int methodId_reuse = 44;
-private static int methodId_updateConnectionReusability = 45;
-private static int methodId_getDataLocator = 46;
-private static int methodId_getPooledConnection = 47;
-private static int methodId_getProperties = 48;
-private static int methodId_SQLMXConnection_LLL = 49;
-private static int methodId_SQLMXConnection_LL_ds = 50;
-private static int methodId_SQLMXConnection_LL_pool = 51;
-private static int methodId_mapTxnMode = 52;
-private static int methodId_mapTxnModeToString = 53;
-private static int methodId_initSetDefaults = 54;
-private static int methodId_getCharsetEncodingCached = 55;
-private static int methodId_getSchema = 56;
-private static int totalMethodIds = 57;
+private static int methodId_begintransaction = 35;
+private static int methodId_mapTxnIsolation = 36;
+private static int methodId_gcStmts = 37;
+private static int methodId_removeElement_L = 38;
+private static int methodId_removeElement_V = 39;
+private static int methodId_addElement = 40;
+private static int methodId_connectInit = 41;
+private static int methodId_reuse = 42;
+private static int methodId_updateConnectionReusability = 43;
+private static int methodId_getDataLocator = 44;
+private static int methodId_getPooledConnection = 45;
+private static int methodId_getProperties = 46;
+private static int methodId_SQLMXConnection_LLL = 47;
+private static int methodId_SQLMXConnection_LL_ds = 48;
+private static int methodId_SQLMXConnection_LL_pool = 49;
+private static int methodId_mapTxnMode = 50;
+private static int methodId_mapTxnModeToString = 51;
+private static int methodId_initSetDefaults = 52;
+private static int methodId_getCharsetEncodingCached = 53;
+private static int methodId_getSchema = 54;
+private static int totalMethodIds = 55;
 private static JdbcDebug[] debug;
 
     static {
@@ -2869,10 +2712,6 @@
             debug[methodId_setTransactionIsolation] = new JdbcDebug(className,
                     "setTransactionIsolation");
             debug[methodId_setTypeMap] = new JdbcDebug(className, "setTypeMap");
-            debug[methodId_cpqPrepareStatement] = new JdbcDebug(className,
-                    "cpqPrepareStatement");
-            debug[methodId_cpqPrepareCall] = new JdbcDebug(className,
-                    "cpqPrepareCall");
             debug[methodId_begintransaction] = new JdbcDebug(className,
                     "begintransaction");
             debug[methodId_mapTxnIsolation] = new JdbcDebug(className,
@@ -2914,15 +2753,10 @@
     int dsTransactionMode_;
     String dsIso88591EncodingOverride_;
     boolean dsContBatchOnError_; // RFE: Batch update improvements
-    // MFC - std version and timestamp for the cached modules.
-    static final int moduleVersion_ = 12;//R3.0 changes
-    static final long moduleTimestamp_ = 1234567890;
-    static final Object lockForMFCPrep = new Object();
     static final HashMap<Long, Long> mapOfClosedDialogs = new HashMap<Long, Long>();
     static private long keyForMapCounter = 0;
 private long keyForMap;
 
-    Set setOfCQDs = new HashSet();
 private PrintWriter tracer;
     PreparedStatement clearCQD1;
     PreparedStatement clearCQD2;
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXParameterMetaData.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXParameterMetaData.java
index 320b5a2..03dbd27 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXParameterMetaData.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXParameterMetaData.java
@@ -132,23 +132,6 @@
 		}
 	}
  	
-	/* cpqGetCharacterName (extended) method added to allow SQLJ to           */
-	/* pull character data types from SQL/MX encoding info in the COLS table. */  
-	public String cpqGetCharacterSet(int param) throws SQLException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_cpqGetCharacterSet].methodEntry();
-		try
-		{
-			if ((param > inputDesc_.length) || (param <= 0))
-				throw Messages.createSQLException(connection_.locale_,"invalid_desc_index", null);
-			return inputDesc_[param-1].getCharacterSetName();
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_cpqGetCharacterSet].methodExit();
-		}
-	}
-
 	public int isNullable(int param) throws SQLException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_isNullable].methodEntry();
@@ -202,13 +185,12 @@
 	private static int methodId_getParameterMode		=  2;
 	private static int methodId_getParameterType		=  3;
 	private static int methodId_getParameterTypeName	=  4;
-	private static int methodId_getPrecision			=  5;
-	private static int methodId_getScale				=  6;
-	private static int methodId_cpqGetCharacterSet		=  7;
-	private static int methodId_isNullable				=  8;
-	private static int methodId_isSigned				=  9;
-	private static int methodId_SQLMXParameterMetaData	= 10;
-	private static int totalMethodIds					= 11;
+	private static int methodId_getPrecision		=  5;
+	private static int methodId_getScale			=  6;
+	private static int methodId_isNullable			=  7;
+	private static int methodId_isSigned			=  8;
+	private static int methodId_SQLMXParameterMetaData	= 9;
+	private static int totalMethodIds			= 10;
 	private static JdbcDebug[] debug;
 
 	static
@@ -224,7 +206,6 @@
 			debug[methodId_getParameterTypeName] = new JdbcDebug(className,"getParameterTypeName");
 			debug[methodId_getPrecision] = new JdbcDebug(className,"getPrecision");
 			debug[methodId_getScale] = new JdbcDebug(className,"getScale");
-			debug[methodId_cpqGetCharacterSet] = new JdbcDebug(className,"cpqGetCharacterSet");
 			debug[methodId_isNullable] = new JdbcDebug(className,"isNullable");
 			debug[methodId_isSigned] = new JdbcDebug(className,"isSigned");
 			debug[methodId_SQLMXParameterMetaData] = new JdbcDebug(className,"SQLMXParameterMetaData");
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPreparedStatement.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPreparedStatement.java
index b82390b..3bb992b 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPreparedStatement.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPreparedStatement.java
@@ -4671,9 +4671,6 @@
 			if (paramRowCount_ > 0)
 				throw Messages.createSQLException(connection_.locale_,
 						"function_sequence_error", null);
-			if (isCQD) {
-				connection_.setOfCQDs.add(sql_);
-			}
 			checkIfAllParamsSet();
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -5107,34 +5104,6 @@
 				debug[methodId_populateLobObjects].methodExit();
 		}
 	}
-//venu changed dialogueId from int to long for 64 bit
-	void cpqPrepare(String server, long dialogueId, int txid,
-			boolean autoCommit, String moduleName, int moduleVersion,
-			long moduleTimestamp, String stmtName, boolean isSelect,
-			int queryTimeout, int holdability) {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_cpqPrepare].methodEntry();
-		if (JdbcDebugCfg.traceActive)
-			debug[methodId_cpqPrepare].methodParameters(server + ","
-					+ Long.toString(dialogueId) + ","
-					+ Long.toString(txid) + ","
-					+ Boolean.toString(autoCommit) + "," + moduleName + ","
-					+ Integer.toString(moduleVersion) + ","
-					+ Long.toString(moduleTimestamp) + "," + stmtName + ","
-					+ Boolean.toString(isSelect) + ","
-					+ Integer.toString(queryTimeout) + ","
-					+ Integer.toString(holdability));
-		try {
-			cpqPrepareJNI(server, dialogueId, txid, autoCommit,
-					connection_.transactionMode_, moduleName, moduleVersion,
-					moduleTimestamp, stmtName, isSelect, queryTimeout,
-					holdability, batchBindingSize_, fetchSize_, "",false);
-
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_cpqPrepare].methodExit();
-		}
-	}
 
 	// Constructors with access specifier as "default"
 	SQLMXPreparedStatement(SQLMXConnection connection, String sql)
@@ -5191,12 +5160,6 @@
 			String iso88591Encoding, SQLMXResultSet resultSet,
 			boolean contBatchOnError) throws SQLException;
 
-	native void cpqPrepareJNI(String server, long dialogueId, int txid,
-			boolean autoCommit, int txnMode, String moduleName,
-			int moduleVersion, long moduleTimestamp, String stmtName,
-			boolean isSelect, int queryTimeout, int holdability, int batchSize,
-			int fetchSize, String sql,boolean isISUD);
-	
 	private native void resetFetchSize(long dialogueId, long stmtId, int fetchSize);
 
 	// fields
@@ -5346,13 +5309,12 @@
 	private static int methodId_reuse = 61;
 	private static int methodId_close = 62;
 	private static int methodId_populateLobObjects = 63;
-	private static int methodId_cpqPrepare = 65;
-	private static int methodId_SQLMXPreparedStatement_LLIII = 66;
-	private static int methodId_SQLMXPreparedStatement_LLIJLZI = 67;
-	private static int methodId_setFetchSize = 68;
-	private static int methodId_getFetchSize = 69;
+	private static int methodId_SQLMXPreparedStatement_LLIII = 65;
+	private static int methodId_SQLMXPreparedStatement_LLIJLZI = 66;
+	private static int methodId_setFetchSize = 67;
+	private static int methodId_getFetchSize = 68;
 	
-	private static int totalMethodIds = 70;
+	private static int totalMethodIds = 69;
 	
 	private static JdbcDebug[] debug;
 
@@ -5461,7 +5423,6 @@
 			debug[methodId_close] = new JdbcDebug(className, "close");
 			debug[methodId_populateLobObjects] = new JdbcDebug(className,
 					"populateLobObjects");
-			debug[methodId_cpqPrepare] = new JdbcDebug(className, "cpqPrepare");
 			debug[methodId_SQLMXPreparedStatement_LLIII] = new JdbcDebug(
 					className, "SQLMXPreparedStatement_LLIII");
 			debug[methodId_SQLMXPreparedStatement_LLIJLZI] = new JdbcDebug(
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSetMetaData.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSetMetaData.java
index 7599f83..5ba4648 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSetMetaData.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSetMetaData.java
@@ -183,24 +183,6 @@
 		}
 	}
  	
-	/* cpqGetCharacterName (extended) method added to allow SQLJ to */
-	/* pull character data types from SQL/MX encoding info in the   */
-	/* COLS table. Valid types are UCS2, ISO88591, or null.         */ 
-	public String cpqGetCharacterSet(int column) throws SQLException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_cpqGetCharacterSet].methodEntry();
-		try
-		{
-			if ((column > outputDesc_.length) || (column <= 0))
-				throw Messages.createSQLException(connection_.locale_,"invalid_desc_index", null);
-			return outputDesc_[column-1].getCharacterSetName();
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_cpqGetCharacterSet].methodExit();
-		}
-	}
-
 	public String getSchemaName(int column) throws SQLException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_getSchemaName].methodEntry();
@@ -396,30 +378,29 @@
 	SQLMXDesc[]		outputDesc_;
 	
 	private static int methodId_getCatalogName					=  0;
-	private static int methodId_getColumnClassName				=  1;
+	private static int methodId_getColumnClassName					=  1;
 	private static int methodId_getColumnCount					=  2;
-	private static int methodId_getColumnDisplaySize			=  3;
+	private static int methodId_getColumnDisplaySize				=  3;
 	private static int methodId_getColumnLabel					=  4;
 	private static int methodId_getColumnName					=  5;
 	private static int methodId_getColumnType					=  6;
-	private static int methodId_getColumnTypeName				=  7;
+	private static int methodId_getColumnTypeName					=  7;
 	private static int methodId_getPrecision					=  8;
 	private static int methodId_getScale						=  9;
-	private static int methodId_cpqGetCharacterSet				= 10;
-	private static int methodId_getSchemaName					= 11;
-	private static int methodId_getTableName					= 12;
-	private static int methodId_isAutoIncrement					= 13;
-	private static int methodId_isCaseSensitive					= 14;
-	private static int methodId_isCurrency						= 15;
-	private static int methodId_isDefinitelyWritable			= 16;
-	private static int methodId_isNullable						= 17;
-	private static int methodId_isReadOnly						= 18;
-	private static int methodId_isSearchable					= 19;
-	private static int methodId_isSigned						= 20;
-	private static int methodId_isWritable						= 21;
-	private static int methodId_SQLMXResultSetMetaData_LL_stmt	= 22;
-	private static int methodId_SQLMXResultSetMetaData_LL_rs	= 23;
-	private static int totalMethodIds							= 24;
+	private static int methodId_getSchemaName					= 10;
+	private static int methodId_getTableName					= 11;
+	private static int methodId_isAutoIncrement					= 12;
+	private static int methodId_isCaseSensitive					= 13;
+	private static int methodId_isCurrency						= 14;
+	private static int methodId_isDefinitelyWritable				= 15;
+	private static int methodId_isNullable						= 16;
+	private static int methodId_isReadOnly						= 17;
+	private static int methodId_isSearchable					= 18;
+	private static int methodId_isSigned						= 19;
+	private static int methodId_isWritable						= 20;
+	private static int methodId_SQLMXResultSetMetaData_LL_stmt			= 21;
+	private static int methodId_SQLMXResultSetMetaData_LL_rs			= 22;
+	private static int totalMethodIds						= 23;
 	private static JdbcDebug[] debug;
 	
 	static
@@ -438,7 +419,6 @@
 			debug[methodId_getColumnTypeName] = new JdbcDebug(className,"getColumnTypeName"); 
 			debug[methodId_getPrecision] = new JdbcDebug(className,"getPrecision"); 
 			debug[methodId_getScale] = new JdbcDebug(className,"getScale"); 
-			debug[methodId_cpqGetCharacterSet] = new JdbcDebug(className,"cpqGetCharacterSet"); 
 			debug[methodId_getSchemaName] = new JdbcDebug(className,"getSchemaName"); 
 			debug[methodId_getTableName] = new JdbcDebug(className,"getTableName"); 
 			debug[methodId_isAutoIncrement] = new JdbcDebug(className,"isAutoIncrement"); 
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXStatement.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXStatement.java
index 3a5bd10..cdbab6d 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXStatement.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXStatement.java
@@ -1062,9 +1062,6 @@
 			validateExecDirectInvocation();
 			isSelect_ = getStmtSqlType(sql);
 			sql_ = sql;
-			if(SQLMXConnection.getSqlStmtType(sql) == SQLMXConnection.TYPE_CONTROL){
-				connection_.setOfCQDs.add(sql);
-			}
 		} finally {
 			if (JdbcDebugCfg.entryActive)
 				debug[methodId_validateExecDirectInvocation_L].methodExit();
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java
index 53efe2e..3f77c58 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java
@@ -286,11 +286,9 @@
 	}
 
 	// Native methods
-	// MFC- SQLMXInitialize now contains 2 more parameters
 	static native int getPid();
 
-	native static void SQLMXInitialize(String language, int nowaitOn,
-			String modulecaching, String compiledmodulelocation);
+	native static void SQLMXInitialize(String language, int nowaitOn);
 
 	native static void setDefaultEncoding(String encoding);
 
@@ -369,7 +367,7 @@
 		checkLibraryVersion(DriverInfo.driverVproc);
 		
 		// Initialize Java objects, methods references into gJNICache
-		SQLMXInitialize(locale_.getLanguage(), 1, "OFF", null);
+		SQLMXInitialize(locale_.getLanguage(), 1);
 		
     	// Get the major and minor database version numbers that
 		// were setup in SQLMXInitialize()
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java
index ec03d17..ccc6a67 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java
@@ -79,10 +79,6 @@
     private int maxIdleTime_;
     private int maxStatements_;
 
-    //MFC
-    private String enableMFC_;
-    private String compiledModuleLocation_;
-
     private String externalCallHandler = "NONE";
     private String externalCallPrefix = "EXT";
 
@@ -661,39 +657,6 @@
         setMaxStatements(maxStmt);
 
     }
-    /**
-     * @return the enableMFC_
-     */
-    public String getEnableMFC() {
-        return enableMFC_;
-    }
-
-    /**
-     * @param enableMFC_ the enableMFC_ to set
-     */
-    public void setEnableMFC(String enableMFC_) {
-        if(enableMFC_ != null)
-            this.enableMFC_ = enableMFC_.toUpperCase();
-        else
-            this.enableMFC_ = "OFF";
-    }
-
-    /**
-     * @return the compiledModuleLocation_
-     */
-    public String getCompiledModuleLocation() {
-        return compiledModuleLocation_;
-    }
-
-    /**
-     * @param compiledModuleLocation_ the compiledModuleLocation_ to set
-     */
-    public void setCompiledModuleLocation(String compiledModuleLocation_) {
-        if(compiledModuleLocation_ !=null)
-            this.compiledModuleLocation_ = compiledModuleLocation_;
-        else
-            this.compiledModuleLocation_ = "/usr/tandem/sqlmx/USERMODULES";
-    }
 
     /**
      * @return the externalCallHandler
@@ -1037,10 +1000,6 @@
 	setInlineLobChunkSize(getProperty("inlineLobChunkSize"));
 	setLobChunkSize(getProperty("lobChunkSize"));
 
-        setEnableMFC(getProperty("enableMFC"));
-        setCompiledModuleLocation(getProperty("compiledModuleLocation"));
-
-
 //		setContBatchOnErrorval(getProperty(""));
 
 //		setEnableLog(getProperty("enableLog"));
@@ -1094,10 +1053,6 @@
         props.setProperty("initialPoolSize", String.valueOf(initialPoolSize_));
  	props.setProperty("inlineLobChunkSize", String.valueOf(inlineLobChunkSize_));
  	props.setProperty("lobChunkSize", String.valueOf(lobChunkSize_));
-        if (getEnableMFC() != null)
-            props.setProperty("enableMFC", enableMFC_);
-        if (getCompiledModuleLocation() != null)
-            props.setProperty("compiledModuleLocation", compiledModuleLocation_);
 
         // props.setProperty("",);
         // props.setProperty("enableLog",);
@@ -1232,13 +1187,6 @@
                 "idMapFile", idMapFile);
         propertyInfo[i].description = "Specifies the file to which the trace facility logs SQL statement IDs and the corresponding JDBC SQL statements.";
         propertyInfo[i++].choices = null;
-        /*
-         * MFC: Module Caching Description: Type 2 driver now supports
-         * compiled module caching
-         */
-        propertyInfo[i] = new java.sql.DriverPropertyInfo("enableMFC",
-                enableMFC_);
-        propertyInfo[i++].choices = null;
         propertyInfo[i] = new java.sql.DriverPropertyInfo("queryExecuteTime",Long.toString(queryExecuteTime_));
         propertyInfo[i].description="Sets the queryExecuteTime";
         propertyInfo[i++].choices = null;
@@ -1247,14 +1195,6 @@
         propertyInfo[i].description="set the Trace file to log sql queries which are taking more the queryExecuteTime";
         propertyInfo[i++].choices = null;
 
-        propertyInfo[i].description = "Sets module caching feature to on or off";
-        propertyInfo[i++].choices = null;
-
-        propertyInfo[i] = new java.sql.DriverPropertyInfo(
-                "compiledModuleLocation", compiledModuleLocation_);
-        propertyInfo[i].description = "Specifies the directory to cache the compiled modules";
-        propertyInfo[i++].choices = null;
-// Publishing
         propertyInfo[i] = new java.sql.DriverPropertyInfo(
                 "statisticsIntervalTime", Integer.toString(statisticsIntervalTime_));
         propertyInfo[i].description = "Time in seconds on how often the aggregation data should be published. Default is 60";
@@ -1321,9 +1261,6 @@
                 .toString(getLobChunkSize())));
         ref.add(new StringRefAddr("transactionMode",getTransactionMode()));
         ref.add(new StringRefAddr("contBatchOnError",getContBatchOnError()));
-        //Renamed the modulecaching property as enableMFC
-        ref.add(new StringRefAddr("enableMFC", getEnableMFC()));
-        ref.add(new StringRefAddr("compiledModuleLocation",	getCompiledModuleLocation()));
         ref.add(new StringRefAddr("queryExecuteTime",Long.toString(queryExecuteTime_)));
         ref.add(new StringRefAddr("T2QueryExecuteLogFile",T2QueryExecuteLogFile_));
 
diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp
index e004aab..6622034 100644
--- a/core/sql/cli/Context.cpp
+++ b/core/sql/cli/Context.cpp
@@ -296,21 +296,20 @@
 {
   ComDiagsArea *diags = NULL;
 
-  if (volatileSchemaCreated())
+  if (volatileSchemaCreated_)
     {
       // drop volatile schema, if one exists
       short rc =
         ExExeUtilCleanupVolatileTablesTcb::dropVolatileSchema
         (this, NULL, exCollHeap(), diags);
+      if (rc < 0 && diags != NULL && diags->getNumber(DgSqlCode::ERROR_) > 0) {
+         ComCondition *condition = diags->getErrorEntry(0);
+         logAnMXEventForError(*condition, GetCliGlobals()->getEMSEventExperienceLevel()); 
+      } 
       SQL_EXEC_ClearDiagnostics(NULL);
-      
-      rc =
-        ExExeUtilCleanupVolatileTablesTcb::dropVolatileTables
-        (this, exCollHeap());
+      volatileSchemaCreated_ = FALSE;
     }
 
-  volTabList_ = 0;
-
   SQL_EXEC_ClearDiagnostics(NULL);
 
   delete moduleList_;
@@ -2907,6 +2906,11 @@
     {
       rc = ExExeUtilCleanupVolatileTablesTcb::dropVolatileSchema
         (this, NULL, exHeap(), diags);
+      if (rc < 0 && diags != NULL && diags->getNumber(DgSqlCode::ERROR_) > 0) {
+         ComCondition *condition = diags->getErrorEntry(0);
+         logAnMXEventForError(*condition, GetCliGlobals()->getEMSEventExperienceLevel()); 
+      } 
+      volatileSchemaCreated_ = FALSE;
       SQL_EXEC_ClearDiagnostics(NULL);
     }
 
@@ -2934,10 +2938,7 @@
   // prevStmtStats_ is decremented so that it can be freed up when
   // GC happens in mxssmp
   setStatsArea(NULL, FALSE, FALSE, TRUE);
-
-  volatileSchemaCreated_ = FALSE;
-
-  HiveClient_JNI::deleteInstance();  
+  HiveClient_JNI::deleteInstance();
   disconnectHdfsConnections();
 }
 
@@ -2959,8 +2960,6 @@
   Lng32 cliRC = cliInterface.executeImmediate(sendCQD);
   NADELETEBASIC(sendCQD, exHeap());
   
-  volatileSchemaCreated_ = FALSE;
-  
   if (savedDiagsArea)
     {
       diagsArea_.mergeAfter(*savedDiagsArea);
diff --git a/core/sql/executor/ExExeUtilVolTab.cpp b/core/sql/executor/ExExeUtilVolTab.cpp
index f3db9d3..8e3e275 100644
--- a/core/sql/executor/ExExeUtilVolTab.cpp
+++ b/core/sql/executor/ExExeUtilVolTab.cpp
@@ -690,7 +690,7 @@
   //  currContext->resetSqlParserFlags(0x8000); // ALLOW_VOLATILE_SCHEMA_CREATION
 
   NADELETEBASIC(dropSchema, heap);
-
+  currContext->resetVolTabList();
   return cliRC;
 }
 
@@ -728,7 +728,7 @@
   strcpy(sendCQD, "CONTROL QUERY DEFAULT VOLATILE_SCHEMA_IN_USE 'FALSE';");
   cliInterface.executeImmediate(sendCQD);
   NADELETEBASIC(sendCQD, heap);
-
+  currContext->resetVolTabList();
   return cliRC;
 }
 
diff --git a/core/sql/executor/ex_ddl.cpp b/core/sql/executor/ex_ddl.cpp
index 30181b9..024227d 100644
--- a/core/sql/executor/ex_ddl.cpp
+++ b/core/sql/executor/ex_ddl.cpp
@@ -1650,6 +1650,11 @@
 	case REMOVE_FROM_VOL_TAB_LIST_:
 	  {
 	    HashQueue * volTabList = currContext->getVolTabList();
+	    if (volTabList == NULL) {
+	       step_ = DONE_;
+	       break;
+	    }
+        
 	    volTabList->position(pvtTdb().volTabName_,
 				 pvtTdb().volTabNameLen_);
 	    void * name = volTabList->getNext();
diff --git a/core/sql/sqlmxevents/logmxevent_traf.h b/core/sql/sqlmxevents/logmxevent_traf.h
index 1432535..d9a77f6 100644
--- a/core/sql/sqlmxevents/logmxevent_traf.h
+++ b/core/sql/sqlmxevents/logmxevent_traf.h
@@ -64,6 +64,7 @@
 #endif 
 
 #include "QRLogger.h"
+#include "ComDiags.h"
 
 class SQLMXLoggingArea
 {
@@ -189,4 +190,7 @@
 																									 
 };
 
+void logAnMXEventForError( ComCondition & condition, SQLMXLoggingArea::ExperienceLevel emsEventEL);
+
+
 #endif