Merge pull request #1858 from selvaganesang/nadefaults_changes

[TRAFODION-3328] Code cleanup in NADefaults
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InputOutput.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InputOutput.java
index e041e61..0e02ebf 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InputOutput.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InputOutput.java
@@ -25,6 +25,8 @@
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
 import java.nio.ByteBuffer;
@@ -49,7 +51,7 @@
 	private OutputStream m_os;
 	private InputStream m_is;
 	private WritableByteChannel m_wbc;
-	private T4Connection m_t4conn; // trace_connection
+	private InterfaceConnection ic;
 	//private int m_sendBufSize;
 	
 	private char compress = Header.NO;			//Header.NO means no compression is used. 
@@ -62,7 +64,7 @@
 
         // This is minimum time the socket read and write will wait
         // All other timeouts will be multiple of this timeout
-        private int m_networkTimeout;
+        private int m_networkTimeoutInMillis;
 
 	static {
 		try {
@@ -95,7 +97,7 @@
 		m_dialogueId = 0;
 		m_timeout = 0;
 		m_connectionIdleTimeout = 0;
-		
+		m_networkTimeoutInMillis = m_addr.m_t4props.getNetworkTimeoutInMillis();
 		if(m_addr.m_t4props.getCompression()) {
 			compress = Header.YES;
 		}
@@ -105,11 +107,10 @@
 
 	} // end InputOutput
 
-	// trace_connection - AM
-	void setT4Connection(T4Connection t4conn) {
-		m_t4conn = t4conn;
+	void setInterfaceConnection(InterfaceConnection ic) {
+		this.ic = ic;
 	}
-	
+
 	void setDialogueId(int dialogueId) {
 		m_dialogueId = dialogueId;
 	}
@@ -122,9 +123,20 @@
 		m_connectionIdleTimeout = timeout;
 	}
 	
-        void setNetworkTimeout(int timeout) {
-           m_networkTimeout = timeout; 
-        }
+	void setNetworkTimeoutInMillis(int timeout) throws SQLException {
+		int oldTimeout = m_networkTimeoutInMillis;
+		if (timeout == 0)
+			m_networkTimeoutInMillis = T4Properties.DEFAULT_NETWORK_TIMEOUT_IN_MILLIS;
+		else
+           		m_networkTimeoutInMillis = timeout; 
+		if (m_socket != null && m_networkTimeoutInMillis != oldTimeout) { 
+			try {
+				m_socket.setSoTimeout(m_networkTimeoutInMillis);
+			} catch (java.net.SocketException e) {
+				throw new SQLException(e);
+			}
+		}
+	}
 
 	String getRemoteHost() {
 		return this.m_addr.getIPorName();
@@ -133,10 +145,10 @@
 	// ----------------------------------------------------------
 	synchronized void openIO() throws SQLException {
 		// trace_connection - AM
-		if (m_t4conn != null && m_t4conn.m_ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-			Object p[] = T4LoggingUtilities.makeParams(m_t4conn.m_ic.t4props_);
+		if (ic != null && ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
+			Object p[] = T4LoggingUtilities.makeParams(ic.t4props_);
 			String temp = "m_socket=" + m_socket;
-			m_t4conn.m_ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "openIO", temp, p);
+			ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "openIO", temp, p);
 		}
 		if (m_socket == null) {
 			int numTry = 0;
@@ -160,53 +172,19 @@
 				i = 0;
 				while (found == false && i < m_addr.m_inetAddrs.length) {
 					try {
-						//System.out.println(m_addr.m_inetAddrs[i] + ":" + m_addr.m_portNumber.intValue());
-						m_socket = m_factory.createSocket(m_addr.m_inetAddrs[i], m_addr.m_portNumber.intValue());
-//						m_socket = new Socket(InetAddress.getByName("a.b.c.d"),5358);
-						m_socket.setKeepAlive(this.m_addr.m_t4props.getKeepAlive());
-						m_socket.setSoLinger(false, 0); // Make sure the socket
+						m_socket = m_factory.createSocket();
+						int connectTimeout;
+						if (m_timeout == 0)	
+							connectTimeout = T4Properties.DEFAULT_CONNECT_TIMEOUT_IN_SECS * 1000; 
+						else
+							connectTimeout = m_timeout * 1000;
+						m_socket.connect(new InetSocketAddress(m_addr.m_inetAddrs[i], m_addr.m_portNumber.intValue()), connectTimeout);
 						m_socket.setKeepAlive(true);
-						// can immediately
-						// reused if connection
-						// is lost.
-						//Set the network timeout to be at least 10 seconds
-						if (m_networkTimeout == 0)
-                                                    m_networkTimeout = 10;
-						m_socket.setSoTimeout(m_networkTimeout * 1000);
-                        // disable/enable Nagle's algorithm
-                        m_socket.setTcpNoDelay(this.m_addr.m_t4props.getTcpNoDelay());
-						//
-						// Note, I have not set a timeout here for either the
-						// conneciton or for
-						// read operations on the socket. I need to figure out
-						// what the
-						// semantics should be, and add this logic.
-						//
-						// Although the user can set a
-						// connection timeout, we
-						// do not set the timeout on the open/connect of the
-						// socket. Instead
-						// we use the default system TCP/IP timeout. In theory,
-						// this may be
-						// longer than the user login timeout. Also, we keep
-						// trying to create/connect
-						// the socket a minimun of 3 times. In theory, this
-						// could really mess up the
-						// user's use of login timeout. For example, if the user
-						// login timeout is
-						// small (e.g. 5 sec.), and the TCP/IP default socket
-						// create/connect timeout
-						// is large (e.g. 10 sec.), and the number of inetAddrs
-						// is large (e.g. 5),
-						// and the correct inetAddr is the last one on the list,
-						// and the AS server
-						// isn't ready until the last try, we could end up
-						// taking way more than
-						// the user specified login time to connect (3 * 10 * 5
-						// = 150 seconds vs.
-						// 5 sec. the user specified!).
-						//
-						//
+						m_socket.setSoLinger(false, 0); // Make sure the socket can immediately reused if connection is lost.
+						m_socket.setSoTimeout(m_networkTimeoutInMillis);
+						// disable/enable Nagle's algorithm
+						m_socket.setTcpNoDelay(this.m_addr.m_t4props.getTcpNoDelay());
+
 						m_os = m_socket.getOutputStream();
 						m_wbc = Channels.newChannel(m_os);
 						m_is = m_socket.getInputStream();
@@ -215,11 +193,11 @@
 						// Swastik: added code to start connection idle timers
 						startConnectionIdleTimeout();
 						// trace_connection - AM
-						if (m_t4conn != null && m_t4conn.m_ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-							Object p[] = T4LoggingUtilities.makeParams(m_t4conn.m_ic.t4props_);
+						if (ic != null && ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
+							Object p[] = T4LoggingUtilities.makeParams(ic.t4props_);
 							String temp = "found=" + found + ",numTry=" + numTry + ",i=" + i
 									+ ",m_addr.m_inetAddrs.length=" + m_addr.m_inetAddrs.length;
-							m_t4conn.m_ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "openIO", temp, p);
+							ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "openIO", temp, p);
 						}
 					} catch (Exception e) {
 						//
@@ -247,11 +225,11 @@
 			} // end while
 			if (found == false) {
 				// trace_connection - AM
-				if (m_t4conn != null && m_t4conn.m_ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-					Object p[] = T4LoggingUtilities.makeParams(m_t4conn.m_ic.t4props_);
+				if (ic != null && ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
+					Object p[] = T4LoggingUtilities.makeParams(ic.t4props_);
 					String temp = "found=" + found + ",numTry=" + numTry + ",i=" + i + ",m_addr.m_inetAddrs.length="
 							+ m_addr.m_inetAddrs.length;
-					m_t4conn.m_ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "openIO", temp, p);
+					ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "openIO", temp, p);
 				}
 				//
 				// Couldn't open the socket
@@ -310,10 +288,10 @@
 		}
 		
 		// trace_connection - AM
-		if (m_t4conn != null && m_t4conn.m_ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-			Object p[] = T4LoggingUtilities.makeParams(m_t4conn.m_ic.t4props_);
+		if (ic != null && ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
+			Object p[] = T4LoggingUtilities.makeParams(ic.t4props_);
 			String temp = "MessageBuffer";
-			m_t4conn.m_ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "doIO", temp, p);
+			ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "doIO", temp, p);
 		}
 		Header wheader = new Header(odbcAPI, m_dialogueId, totalLength - readHdrLength// minus
 																					// the
@@ -368,11 +346,11 @@
 			totalNumRead = totalNumRead + numRead;
 			whileCount1 = whileCount1 + 1;
 			// trace_connection - AM
-			if (m_t4conn != null && m_t4conn.m_ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-				Object p[] = T4LoggingUtilities.makeParams(m_t4conn.m_ic.t4props_);
+			if (ic != null && ic.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
+				Object p[] = T4LoggingUtilities.makeParams(ic.t4props_);
 				String temp = "MessageBuffer whileCount1=" + whileCount1 + ",numRead=" + numRead + ",totalNumRead="
 						+ totalNumRead;
-				m_t4conn.m_ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "doIO", temp, p);
+				ic.t4props_.t4Logger_.logp(Level.FINEST, "InputOutput", "doIO", temp, p);
 			}
 		} // end while
 
@@ -451,12 +429,11 @@
 	} // end doIO
 
 	// ----------------------------------------------------------
-	synchronized void CloseIO(LogicalByteArray buffer) throws SQLException {
-		/*Header hdr = new Header(Header.CLOSE_TCPIP_SESSION, m_dialogueId, 0, 0, Header.NO, Header.COMP_0,
-				Header.CLOSE_TCPIP_SESSION, Header.SIGNATURE, Header.VERSION, Header.PC, Header.TCPIP, Header.NO);
+	synchronized void closeIO() throws SQLException {
 
-		TCPIPDoWrite(hdr, buffer, 0, hdr.sizeOf());*/
 		try {
+			//m_socket.shutdownInput();
+			//m_socket.shutdownOutput();
 			m_socket.close();
 			m_socket = null;
 		} catch (Exception e) {
@@ -466,7 +443,7 @@
 		} finally {
 			closeTimers();
 		}
-	} // end CloseIO
+	} // end closeIO
 
 	void TCPIPWriteByteBuffer(ByteBuffer buffer) throws SQLException {
 
@@ -545,7 +522,7 @@
 		switch (hdr.hdr_type_) {
 		case Header.READ_RESPONSE_FIRST:
 		case Header.READ_RESPONSE_NEXT:
-			numRead = recv_nblk(buffer.getBuffer(), buffer_index);	
+			numRead = recv_nblk((int)hdr.operation_id_, buffer.getBuffer(), buffer_index);	
 //			buffer.setLocation(numRead);
 			break;
 		default:
@@ -578,61 +555,80 @@
 	} // end send_nblk
 
 	// ----------------------------------------------------------
-	int recv_nblk(byte[] buf, int offset) throws SQLException {
+	int recv_nblk(int srvrApi, byte[] buf, int offset) throws SQLException {
 		int num_read = 0;
-		boolean retry = false;
+		int activeTime = 0;
+		boolean cancelQueryAllowed = ! (ic.getIgnoreCancel() || ic.t4props_.getIgnoreCancel());
+		int activeTimeBeforeCancel = ic.getActiveTimeBeforeCancel();
+		boolean outerRetry = true;
 		do {
-			try {
-				boolean innerRetry = true;
-                        	int pendingTimeout = m_timeout;
-                                if (pendingTimeout == 0)
-                                   pendingTimeout = Integer.MAX_VALUE;
-				do {
-					try {
-						num_read = m_is.read(buf, offset, buf.length - offset);
-						// if the socket.read returns -1 then return 0 instead of -1
-						if (num_read < 0) 
-							num_read = 0;
-						innerRetry = false;
-						retry = false;
-                        		}
-	                		catch (SocketTimeoutException ste) {
-						pendingTimeout -= m_networkTimeout;
-						if (pendingTimeout < 0) {
-							innerRetry = false;
-							throw ste;
-						}
-                        		}
-				} while (innerRetry);
-			} catch (SocketTimeoutException ste) {
-				// the first exception should try to cancel and wait for the cancel message from the server
-				if (retry == false) {
-					this.m_t4conn.m_ic.cancel();
-					retry = true;
-					continue;
-                		}
-				
-				// if cancel didnt work the first time, clean everything up
+			boolean innerRetry = true;
+			int innerRetryCnt = 0;
+			int pendingTimeout = m_timeout * 1000;
+			if (pendingTimeout == 0)
+				pendingTimeout = Integer.MAX_VALUE;
+			do {
 				try {
-					m_socket.close();
-					this.m_t4conn.m_ic.setIsClosed(true);
-					this.m_t4conn.m_ic.cancel();
-					throw ste;
-				} catch (Exception e) {
-					SQLException se = TrafT4Messages
-							.createSQLException(null, m_locale, "session_close_error", e.getMessage());
-					se.initCause(e);
-					throw se;
+					num_read = m_is.read(buf, offset, buf.length - offset);
+					// if the socket.read returns -1 then return 0 instead of -1
+					if (num_read < 0) 
+						num_read = 0;
+					innerRetry = false;
+					outerRetry = false;
 				}
-			} catch (Exception e) {
-				SQLException se = TrafT4Messages.createSQLException(null, m_locale, "socket_read_error", e.getMessage());
-				se.initCause(e);
+				catch (SocketTimeoutException ste) {
+					pendingTimeout -= m_networkTimeoutInMillis;
+					if (pendingTimeout <= 0) {
+						innerRetry = false;
+						break;
+					}
+				}
+				catch (IOException ioe) {
+					if (innerRetryCnt <= 3) {
+						try {
+							innerRetryCnt++;
+							Thread.sleep(10);
+						} catch(InterruptedException ie) {
+						}
+					} else {
+						SQLException se = TrafT4Messages.createSQLException(null, m_locale, "problem_with_server_read", null);
+						se.setNextException(new SQLException(ioe));
+						if (ic.t4props_.t4Logger_.isLoggable(Level.FINER)) {
+							Object p[] = T4LoggingUtilities.makeParams(ic.t4props_);
+							String temp = "Socket.read returned an exception " + se.toString(); 
+							ic.t4props_.t4Logger_.logp(Level.FINER, "InputOutput", "recv_nblk", temp, p);
+						}
+						throw se; 
+					}
+				}
+			} while (innerRetry);
+			if (! outerRetry)
+				break;
+			// Connection or connection related requests timed out
+			if (srvrApi == TRANSPORT.SRVR_API_SQLCONNECT  || srvrApi == TRANSPORT.AS_API_GETOBJREF) {
+				closeIO();
+				SQLException se = TrafT4Messages.createSQLException(null, m_locale, 
+					"connection timed out in [" + m_timeout + "] seconds", null);
+				if (ic.t4props_.t4Logger_.isLoggable(Level.FINER)) {
+					Object p[] = T4LoggingUtilities.makeParams(ic.t4props_);
+					String temp = "Socket.read timed out in [" + m_timeout + "] seconds, networkTimeoutInMillis " 
+ 						+ m_networkTimeoutInMillis; 
+					ic.t4props_.t4Logger_.logp(Level.FINER, "InputOutput", "recv_nblk", temp, p);
+				}
 				throw se;
-			} finally {
-				resetTimedOutConnection();
 			}
-		} while(retry);
-
+			// Rest of the requests are treated as related to query timeout
+			if (cancelQueryAllowed)
+				ic.cancel(-1);	
+			else if (activeTimeBeforeCancel != -1) {
+				if (m_timeout != 0)
+					activeTime += m_timeout;
+				else
+					activeTime += (m_networkTimeoutInMillis /1000);	
+				if (activeTime >= activeTimeBeforeCancel)
+					ic.cancel(-1);
+			}	
+		} while (outerRetry);
 		return num_read;
 	} // recv_nblk
 
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceConnection.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceConnection.java
index d23d973..0990a65 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceConnection.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceConnection.java
@@ -55,6 +55,7 @@
 	
 	static final short SQL_COMMIT = 0;
 	static final short SQL_ROLLBACK = 1;
+	private int activeTimeBeforeCancel = -1;
 	private int txnIsolationLevel = Connection.TRANSACTION_READ_COMMITTED;
 	private boolean autoCommit = true;
 	private boolean isReadOnly = false;
@@ -131,6 +132,7 @@
 	private String _remoteProcess;
 	private String _connStringHost = "";
 
+        int getActiveTimeBeforeCancel() { return activeTimeBeforeCancel; }
 	InterfaceConnection(TrafT4Connection conn, T4Properties t4props) throws SQLException {
 		_t4Conn = conn;
 		t4props_ = t4props;
@@ -166,7 +168,7 @@
 		// Connection context details
 		inContext = getInContext(t4props);
 		m_ncsSrvr_ref = t4props.getUrl();
-		_ignoreCancel = false;
+		_ignoreCancel = t4props.getIgnoreCancel();
 
 		if (t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
 			Object p[] = T4LoggingUtilities.makeParams(t4props_, t4props);
@@ -217,6 +219,10 @@
 		return this._roleName;
 	}
 
+	boolean getIgnoreCancel() {
+		return this._ignoreCancel;
+	}
+
 	CONNECTION_CONTEXT_def getInContext() {
 		return inContext;
 	}
@@ -477,56 +483,44 @@
 		endTransaction(SQL_ROLLBACK);
 	}
 
-	void cancel() throws SQLException {
-		if(!this._ignoreCancel) {
-			String srvrObjRef = "" + ncsAddr_.getPort();
-			// String srvrObjRef = t4props_.getServerID();
-			int srvrType = 2; // AS server
-			CancelReply cr_ = null;
+	void cancel(long startTime) throws SQLException 
+	{
+		String errorText = null;
+		long currentTime;
+		if (startTime != -1) {
+			if (activeTimeBeforeCancel != -1) {
+				currentTime = System.currentTimeMillis();
+				if ((activeTimeBeforeCancel * 1000) < (currentTime - startTime))
+					return; 
+			}
+		}
+
+		String srvrObjRef = "" + ncsAddr_.getPort();
+		// String srvrObjRef = t4props_.getServerID();
+		int srvrType = 2; // AS server
+		CancelReply cr_ = null;
 	
 			if (t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
 				Object p[] = T4LoggingUtilities.makeParams(t4props_);
-				String temp = "cancel request received for " + srvrObjRef;
+			String temp = "cancel request received for " + srvrObjRef;
 				t4props_.t4Logger_.logp(Level.FINEST, "InterfaceConnection", "connect", temp, p);
-			}
+		}
 	
-			//
-			// Send the cancel to the ODBC association server.
-			//
-			String errorText = null;
-			int tryNum = 0;
-			String errorMsg = null;
-			String errorMsg_detail = null;
-			long currentTime = (new java.util.Date()).getTime();
-			long endTime;
+		cr_ = T4_Dcs_Cancel.cancel(t4props_, this, dialogueId_, srvrType, srvrObjRef, 0);
 	
-			if (inContext.loginTimeoutSec > 0) {
-				endTime = currentTime + inContext.loginTimeoutSec * 1000;
-			} else {
-	
-				// less than or equal to 0 implies infinit time out
-				endTime = Long.MAX_VALUE;
-	
-				//
-				// Keep trying to contact the Association Server until we run out of
-				// time, or make a connection or we exceed the retry count.
-				//
-			}
-			cr_ = T4_Dcs_Cancel.cancel(t4props_, this, dialogueId_, srvrType, srvrObjRef, 0);
-	
-			switch (cr_.m_p1_exception.exception_nr) {
-			case TRANSPORT.CEE_SUCCESS:
+		switch (cr_.m_p1_exception.exception_nr) {
+		case TRANSPORT.CEE_SUCCESS:
 				if (t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
 					Object p[] = T4LoggingUtilities.makeParams(t4props_);
 					String temp = "Cancel successful";
 					t4props_.t4Logger_.logp(Level.FINEST, "InterfaceConnection", "connect", temp, p);
 				}
-				break;
-			default:
+			break;
+		default:
 	
-				//
-				// Some unknown error
-				//
+			//
+			// Some unknown error
+			//
 				if (cr_.m_p1_exception.clientErrorText != null) {
 					errorText = "Client Error text = " + cr_.m_p1_exception.clientErrorText;
 				}
@@ -540,10 +534,7 @@
 					t4props_.t4Logger_.logp(Level.FINEST, "InterfaceConnection", "cancel", temp, p);
 				}
 				throw TrafT4Messages.createSQLException(t4props_, locale, "as_cancel_message_error", errorText);
-			} // end switch
-	
-			currentTime = (new java.util.Date()).getTime();
-		}
+		} // end switch
 	}
 	
 	private void initDiag(boolean setTimestamp, boolean downloadCert) throws SQLException {
@@ -591,7 +582,7 @@
 					}
 
 					try {
-						t4connection_.getInputOutput().CloseIO(new LogicalByteArray(1, 0, false));
+						t4connection_.getInputOutput().closeIO();
 					} catch (Exception e) {
 						// ignore error
 					}
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceStatement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceStatement.java
index 1233148..d1fddf1 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceStatement.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceStatement.java
@@ -1082,8 +1082,10 @@
 	} // end close
 
 	// --------------------------------------------------------------------------
-	void cancel() throws SQLException {
-		ic_.cancel();
+	void cancel(long startTime) throws SQLException {
+		// currently there are no callers to this statement
+		// It is important that callers specify the startTime correctly for cancel work as expected.
+		ic_.cancel(startTime);
 	}
 
 	// --------------------------------------------------------------------------
@@ -1396,14 +1398,18 @@
 	    }
 	}
 
-    private String extractSchema(String sqlString) {
-        String schemaRegex = "(SET)\\s+(SCHEMA)\\s+([a-zA-Z0-9]+\\s*\\.)\\s*([a-zA-Z0-9]+)\\s*";
-        Pattern pattern = Pattern.compile(schemaRegex);
-        Matcher m = pattern.matcher(sqlString.toUpperCase());
-        while (m.find()) {
-            return m.group(m.groupCount());
-        }
-        return "";
-    }
+	private String extractSchema(String sqlString) {
+		String schemaRegex = "(SET)\\s+(SCHEMA)\\s+([a-zA-Z0-9]+\\s*\\.)\\s*([a-zA-Z0-9]+)\\s*";
+		Pattern pattern = Pattern.compile(schemaRegex);
+		Matcher m = pattern.matcher(sqlString.toUpperCase());
+		while (m.find()) {
+			return m.group(m.groupCount());
+		}
+		return "";
+    	}
 
+	protected T4Statement getT4statement() 
+	{
+		return t4statement_;
+    	}
 } // end class InterfaceStatement
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Connection.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Connection.java
index fed6084..5653735 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Connection.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Connection.java
@@ -66,8 +66,8 @@
 		m_io.setDialogueId(m_dialogueId);
 		m_io.setConnectionIdleTimeout(ic.getConnectionTimeout());
 		// trace_connection - AM
-		m_io.setT4Connection(this);
-                m_io.setNetworkTimeout(ic.t4props_.getNetworkTimeout());
+		m_io.setInterfaceConnection(ic);
+		m_io.setNetworkTimeoutInMillis(ic.t4props_.getNetworkTimeoutInMillis());
 		m_io.openIO();
 		getInputOutput().setTimeout(ic.getLoginTimeout());
 		checkConnectionIdleTimeout();
@@ -293,8 +293,7 @@
 			// what to do.
 			//
 			if (tdr1.m_p1.exception_nr == TRANSPORT.CEE_SUCCESS) {
-				m_io.CloseIO(wbuffer); // note, I'm re-using wbuffer
-
+				m_io.closeIO();
 			}
 
 			closeTimers();
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4DSProperties.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4DSProperties.java
index 700dfb1..eb1f5b5 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4DSProperties.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4DSProperties.java
@@ -735,99 +735,6 @@
 	}
 
 	/**
-	 * Sets the table name to store and retrieve the CLOB data for all CLOB
-	 * columns accessed in the connection using the data source.
-	 * 
-	 * @param clobTableName
-	 *            The clob table name, which is in the format
-	 *            <code><var>catalog_name.schema_name.clob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	public void setClobTableName(String clobTableName) throws SQLException {
-		super.setClobTableName(clobTableName);
-	}
-
-	/**
-	 * Retrieves the table name used to store CBLOB data for all CLOB columns
-	 * accessed in the connection using the data source.
-	 * 
-	 * @return the clob table name, which is in the format
-	 *         <code><var>catalog_name.schema_name.clob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	public String getClobTableName() {
-		return super.getClobTableName();
-	}
-
-	/**
-	 * Sets the table name to store and retrieve the BLOB data for all BLOB
-	 * columns accessed in the connection using the data source.
-	 * 
-	 * @param blobTableName
-	 *            the blob table name, which is in the format
-	 *            <code><var>catalog_name.schema_name.blob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	public void setBlobTableName(String blobTableName) throws SQLException {
-		super.setBlobTableName(blobTableName);
-	}
-
-	/**
-	 * Retrieves the table name used to store BLOB data for all BLOB columns
-	 * accessed in the connection using the data source.
-	 * 
-	 * @return the blob table name which is of the format
-	 *         <code><var>catalog_name.schema_name.blob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	public String getBlobTableName() {
-		return super.getBlobTableName();
-	}
-
-	/**
-	 * Configures the number of data locators to be reserved by the Type 4
-	 * connection. Default value is 100.
-	 * 
-	 * @param reserveDataLocator
-	 *            Sets the value of the reserve data locator length for the
-	 *            binding) feature.
-	 * 
-	 * @since 1.1
-	 */
-	public void setReserveDataLocator(String reserveDataLocator) {
-		super.setReserveDataLocator(reserveDataLocator);
-	}
-
-	/**
-	 * Configures the number of data locators to be reserved by the Type 4
-	 * connection. Default value is 100.
-	 * 
-	 * @param reserveDataLocatorLen
-	 *            Sets the value of the reserve data locator length for the Type
-	 *            4 connection.
-	 * 
-	 * @since 1.1
-	 */
-	public void setReserveDataLocator(long reserveDataLocatorLen) {
-		super.setReserveDataLocator(reserveDataLocatorLen);
-	}
-
-	/**
-	 * Returns the value of the reserve data locator length.
-	 * 
-	 * @return The value of the reserved data locator length.
-	 * 
-	 * @since 1.1
-	 */
-	public long getReserveDataLocator() {
-		return super.getReserveDataLocator();
-	}
-
-	/**
 	 * @return Returns the rounding mode set for the driver as an Integer value
 	 *         with one of the values:
 	 * 
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Driver.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Driver.java
index 2808f16..b14ac27 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Driver.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Driver.java
@@ -169,8 +169,7 @@
 					}
 				}
 				if (getMaxPoolSize() != -1) {
-					key = getUrl() + getCatalog() + getSchema() + getUser() + getPassword() + getServerDataSource()
-							+ getBlobTableName() + getClobTableName();
+					key = getUrl() + getCatalog() + getSchema() + getUser() + getPassword() + getServerDataSource();
 	
 					ds = (TrafT4DataSource) dsCache_.get(key);
 	
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java
index fd68e59..3f7640b 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java
@@ -77,6 +77,8 @@
  * </p>
  */
 public class T4Properties {
+    final static int DEFAULT_NETWORK_TIMEOUT_IN_MILLIS = 1000;
+    final static int DEFAULT_CONNECT_TIMEOUT_IN_SECS = 10;
 	private String description_;
 	private String dataSourceName_;
 	private String serverDataSource_;
@@ -92,7 +94,7 @@
 	private int maxStatements_;
 	private int loginTimeout_;
 	// private int closeConnectionTimeout_;
-	private int networkTimeout_;
+	private int networkTimeoutInMillis_ = DEFAULT_NETWORK_TIMEOUT_IN_MILLIS;
 	private int connectionTimeout_;
 	private int maxIdleTime_;
 	private Level t4LogLevel;
@@ -101,7 +103,6 @@
 	private Properties inprops_;
 	private PrintWriter logWriter_;
 	// For LOB Support - SB 9/28/04
-	static long reserveDataLocator_;
 	private int roundMode_;
 	private String language_;
 
@@ -115,10 +116,6 @@
 	private short sqlmxMajorVersion_;
 	private short sqlmxMinorVersion_;
 
-	// LOB Support 
-	String clobTableName_;
-	String blobTableName_;
-
     private int lobChunkSize_ = 10; // default 10M
     private boolean useLobHandle_ = false;
 
@@ -133,6 +130,8 @@
 
 	// propertiy queryTimeout_ for future use.
 	private short queryTimeout_;
+ 	private boolean ignoreCancel_ = true;
+	private int activeTimeBeforeCancel_; 
 	private T4Address t4addr_;
 
 	// Error handling while setting Type 4 properties.
@@ -399,22 +398,8 @@
 		setConnectionTimeout(getProperty("connectionTimeout"));
 		setClipVarchar(getProperty("clipVarchar"));
 		setFetchBufferSize(getProperty("fetchBufferSize")); 
-
-		// For LOB Support - SB 9/28/04
-		try {
-			setClobTableName(getProperty("clobTableName"));
-		} catch (SQLException se) {
-			sqlExceptionMessage_ = "Error while reading the clobTableName property: " + se.getMessage();
-		}
-
-		try {
-			setBlobTableName(getProperty("blobTableName"));
-		} catch (SQLException se2) {
-			sqlExceptionMessage_ = "Error while reading the blobTableName property: " + se2.getMessage();
-		}
-
-		setReserveDataLocator(getProperty("reserveDataLocator"));
 		setQueryTimeout(getProperty("queryTimeout"));
+		setActiveTimeBeforeCancel(getProperty("activeTimeBeforeCancelInSecs"));
 		setRoundingMode(getProperty("roundingMode"));
 		setSPJEnv(getProperty("SPJEnv"));
 		setKeepRawFetchBuffer(getProperty("keepRawFetchBuffer"));
@@ -484,7 +469,7 @@
 		props.setProperty("loginTimeout", String.valueOf(loginTimeout_));
 		// props.setProperty("closeConnectionTimeout",
 		// String.valueOf(closeConnectionTimeout_));
-		props.setProperty("networkTimeout", String.valueOf(networkTimeout_));
+		props.setProperty("networkTimeout", String.valueOf(getNetworkTimeout()));
 		props.setProperty("connectionTimeout", String.valueOf(connectionTimeout_));
 		props.setProperty("description", description_);
 		props.setProperty("dataSourceName", dataSourceName_);
@@ -496,16 +481,10 @@
 		props.setProperty("maxIdleTime", String.valueOf(maxIdleTime_));
 		props.setProperty("language", language_);
 
-		if (getBlobTableName() != null) {
-			props.setProperty("blobTableName", blobTableName_);
-		}
-		if (getClobTableName() != null) {
-			props.setProperty("clobTableName", clobTableName_);
-
-		}
-
 		// properties queryTimeout_ for future use.
 		props.setProperty("queryTimeout", String.valueOf(queryTimeout_));
+		props.setProperty("ignoreCancel", String.valueOf(ignoreCancel_));
+		props.setProperty("activeTimeBeforeCancelInSecs", String.valueOf(activeTimeBeforeCancel_));
 		props.setProperty("roundingMode", String.valueOf(roundMode_));
 		props.setProperty("SPJEnv", String.valueOf(SPJEnv_));
 		props.setProperty("keepRawFetchBuffer", String.valueOf(keepRawFetchBuffer_));
@@ -1257,28 +1236,37 @@
 	 * @param networkTimeout
 	 *            The network timeout value in seconds.
 	 * @see #setNetworkTimeout(int)
-	 * @see #getNetworkTimeout()
+	 * @see #setNetworkTimeout()
 	 */
 	void setNetworkTimeout(int networkTimeout) {
 		if (networkTimeout < 0) {
 			sqlExceptionMessage_ = "Incorrect value for networkTimeout set: " + networkTimeout + ".";
-			networkTimeout_ = 0;
+			networkTimeoutInMillis_ = DEFAULT_NETWORK_TIMEOUT_IN_MILLIS;
 		} else {
-			networkTimeout_ = networkTimeout;
+			networkTimeoutInMillis_ = networkTimeout * 1000;
 		}
 	}
 
+	void setNetworkTimeoutInMillis(int networkTimeoutInMillis) {
+		networkTimeoutInMillis_ = networkTimeoutInMillis;
+	}
+
 	/**
 	 * Returns the network timeout value set for the current Type 4 connection.
 	 * 
 	 * @return the network timeout value in seconds.
-	 * @see #setNetworkTimeout(int)
-	 * @see #setNetworkTimeout(String)
+	 * @see #getNetworkTimeout(int)
+	 * @see #getNetworkTimeout(String)
 	 */
 	int getNetworkTimeout() {
-		return networkTimeout_;
+		return networkTimeoutInMillis_ / 1000;
 	}
 
+        int getNetworkTimeoutInMillis() {
+            return networkTimeoutInMillis_;
+        }
+ 
+
 	// -----------------------------------------------------------------
 
 	/*
@@ -1606,6 +1594,8 @@
 	 *            this property is not supported in the current release.
 	 */
 	void setQueryTimeout(short queryTimeout) {
+		if ((queryTimeout *1000) > networkTimeoutInMillis_)
+			queryTimeout = (short)(networkTimeoutInMillis_ % 1000);
 		queryTimeout_ = queryTimeout;
 	}
 
@@ -1617,6 +1607,50 @@
 		return queryTimeout_;
 	}
 
+	void setIgnoreCancel(String ignoreCancel)
+	{
+		if (ignoreCancel != null)
+			ignoreCancel_ = Boolean.parseBoolean(ignoreCancel);
+		else
+			ignoreCancel_ = true;
+	}
+
+        void setIgnoreCancel(boolean ignoreCancel)
+	{
+		ignoreCancel_ = ignoreCancel;
+	}
+
+	boolean getIgnoreCancel()
+	{
+		return ignoreCancel_;
+	}
+
+	void setActiveTimeBeforeCancel(String activeTimeBeforeCancel) {
+		int tmpActiveTimeBeforeCancel = 0;
+		if (activeTimeBeforeCancel != null) {
+			try {
+				tmpActiveTimeBeforeCancel = Integer.parseInt(activeTimeBeforeCancel);
+			} catch (NumberFormatException ex) {
+				sqlExceptionMessage_ = "Incorrect value for activeTimeBeforeCancel set: " + activeTimeBeforeCancel + ex.getMessage();
+				tmpActiveTimeBeforeCancel = -1;
+			}
+		}
+		setActiveTimeBeforeCancel(tmpActiveTimeBeforeCancel);
+	}
+
+	void setActiveTimeBeforeCancel(int activeTimeBeforeCancel) 
+	{
+		if (activeTimeBeforeCancel < networkTimeoutInMillis_)
+			activeTimeBeforeCancel = networkTimeoutInMillis_;
+		activeTimeBeforeCancel_ = activeTimeBeforeCancel;
+	}
+
+	int getActiveTimeBeforeCancel() 
+	{
+		return activeTimeBeforeCancel_;
+	}
+
+	
 	/**
 	 * Sets the value (in KB) for the size of the fetch buffer. This is used
 	 * when rows are fetched are performed from a ResultSet object after a
@@ -1784,49 +1818,6 @@
 	 */
 
 	/**
-	 * Sets the table name to store and retrieve the CLOB data for all CLOB
-	 * columns accessed in the connection using the data source.
-	 * 
-	 * @param clobTableName
-	 *            The clob table name which is of the format
-	 *            <code><var>catalog_name.schema_name.clob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	void setClobTableName(String clobTableName) throws SQLException {
-		int fromIndex = -1;
-		int count = 0;
-
-		if (clobTableName != null) {
-			while (((fromIndex = clobTableName.indexOf('.', fromIndex + 1)) != -1) && count < 2) {
-				count++;
-			}
-			if (count < 2) {
-				SQLException se = TrafT4Messages.createSQLException(null, null, "no_clobTableName", null);
-				sqlExceptionMessage_ = se.getMessage();
-			}
-			clobTableName_ = clobTableName;
-		} else { // If the name is null, let it be null
-			clobTableName_ = null;
-			// throw TrafT4Messages.createSQLException(null,
-			// null,"no_clobTableName",null);
-		}
-	}
-
-	/**
-	 * Retrieves the table name used to store CBLOB data for all CLOB columns
-	 * accessed in the connection using the data source.
-	 * 
-	 * @return the clob table name which is of the format
-	 *         <code><var>catalog_name.schema_name.clob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	String getClobTableName() {
-		return clobTableName_;
-	}
-
-	/**
 	 * @return any sql exception associated while setting the properties on this
 	 *         Type 4 connection. This mthod is accessed by InterfaceConnection
 	 *         to check if there is any SQL error setting the Type 4 properties.
@@ -1836,106 +1827,6 @@
 		return sqlExceptionMessage_;
 	}
 
-	/**
-	 * Sets the table name to store and retrieve the BLOB data for all BLOB
-	 * columns accessed in the connection using the data source.
-	 * 
-	 * @param blobTableName
-	 *            the blob table name which is of the format
-	 *            <code><var>catalog_name.schema_name.blob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	void setBlobTableName(String blobTableName) throws SQLException {
-		int fromIndex = -1;
-		int count = 0;
-
-		if (blobTableName != null) {
-			while (((fromIndex = blobTableName.indexOf('.', fromIndex + 1)) != -1) && count < 2) {
-				count++;
-			}
-			if (count < 2) {
-				SQLException se = TrafT4Messages.createSQLException(null, null, "no_blobTableName", null);
-				sqlExceptionMessage_ = se.getMessage();
-			}
-			blobTableName_ = blobTableName;
-		}
-		// If the name is null, then let it be null
-		else {
-			blobTableName_ = null;
-			// throw TrafT4Messages.createSQLException(null, null,
-			// "no_blobTableName", null);
-		}
-	}
-
-	/**
-	 * Retrieves the table name used to store BLOB data for all BLOB columns
-	 * accessed in the connection using the data source.
-	 * 
-	 * @return the blob table name which is of the format
-	 *         <code><var>catalog_name.schema_name.blob_table_name</code></var>
-	 * 
-	 * @since 1.1
-	 */
-	String getBlobTableName() {
-		return blobTableName_;
-	}
-
-	/**
-	 * Configure to set the number of data locators to be reserved by the Type 4
-	 * connection. Default value is 100.
-	 * 
-	 * @param reserveDataLocator
-	 *            Set the value of the reserve data locator length for the
-	 *            binding) feature.
-	 * 
-	 * @since 1.1
-	 */
-	void setReserveDataLocator(String reserveDataLocator) {
-		long reserveDataLocatorLen = 100;
-		if (reserveDataLocator != null) {
-			try {
-				reserveDataLocatorLen = Long.parseLong(reserveDataLocator);
-			} catch (NumberFormatException ex) {
-				sqlExceptionMessage_ = "Incorrect value for setReserveDataLocator set: " + reserveDataLocator
-						+ ex.getMessage();
-				reserveDataLocatorLen = 100;
-			}
-		}
-		setReserveDataLocator(reserveDataLocatorLen);
-	}
-
-	/**
-	 * Configure to set the number of data locators to be reserved by the Type 4
-	 * connection. Default value is 100.
-	 * 
-	 * @param reserveDataLocatorLen
-	 *            Set the value of the reserve data locator length for the Type
-	 *            4 connection.
-	 * 
-	 * @since 1.1
-	 */
-	void setReserveDataLocator(long reserveDataLocatorLen) {
-		if (reserveDataLocatorLen < 0) {
-			sqlExceptionMessage_ = "Incorrect value for reserveDataLocator set: " + reserveDataLocatorLen + ".";
-			reserveDataLocator_ = 100;
-		} else {
-			reserveDataLocator_ = reserveDataLocatorLen;
-		}
-	}
-
-	/**
-	 * Return the value of the reserve data locator length.
-	 * 
-	 * @return reserveDataLocatorLength int indicates the value of the reserved
-	 *         data locator length.
-	 * 
-	 * @since 1.1
-	 */
-	long getReserveDataLocator() {
-		return reserveDataLocator_;
-	}
-
     public int getLobChunkSize() {
         return lobChunkSize_;
     }
@@ -2486,21 +2377,12 @@
 		 * Boolean.toString(getUseArrayBinding())));
 		 */
 
-		// LOB Support - SB 9/28/04
-		val = getClobTableName();
-		if (val != null) {
-			ref.add(new StringRefAddr("clobTableName", val));
-		}
-		val = getBlobTableName();
-		if (val != null) {
-			ref.add(new StringRefAddr("blobTableName", val));
-
-		}
-		ref.add(new StringRefAddr("reserveDataLocator", Long.toString(reserveDataLocator_)));
 		ref.add(new StringRefAddr("roundingMode", Integer.toString(getRoundingMode())));
 
 		// propertiy queryTimeout_ for future use.
 		ref.add(new StringRefAddr("queryTimeout", Integer.toString(getQueryTimeout())));
+		ref.add(new StringRefAddr("ignoreCancel", Boolean.toString(getIgnoreCancel())));
+		ref.add(new StringRefAddr("activeTimeBeforeCancelInSecs", Integer.toString(getActiveTimeBeforeCancel())));
 		ref.add(new StringRefAddr("fetchBufferSize", Short.toString(this.getFetchBufferSize())));
 		ref.add(new StringRefAddr("batchRecovery", Boolean.toString(this.getBatchRecovery())));
 		return ref;
@@ -2541,12 +2423,6 @@
 				setPropertyInfo("language", props, false, "Locale language to use", null),
 				setPropertyInfo("serverDataSource", props, false, "NDCS data source name", null),
 				setPropertyInfo("roundingMode", props, false, "Data rounding mode", roundingMode),
-				setPropertyInfo("blobTableName", props, false, "Table name to store and retrieve BLOB column data",
-						null),
-				setPropertyInfo("clobTableName", props, false, "Table name to store and retrieve CLOB column data",
-						null),
-				setPropertyInfo("reserveDataLocator", props, false,
-						"Number of data locators (for LOB) to be reserved by the connection", null),
 				setPropertyInfo("fetchBufferSize", props, false,
 						"Value (in KB) for the size of the fetch buffer to be used when rows are fetched", null),
 				setPropertyInfo("batchRecovery", props, false,
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Statement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Statement.java
index 89a39a2..738f31b 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Statement.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Statement.java
@@ -204,4 +204,10 @@
 		}
 		return buf;
 	}
+
+	public boolean isProcessing() 
+	{
+		 return m_processing;
+	}
+
 }
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Cancel.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Cancel.java
index ecf50aa..99d3279 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Cancel.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Cancel.java
@@ -78,7 +78,7 @@
 			// Send message to the ODBC Association server.
 			//
 			InputOutput io1 = address1.getInputOutput();
-
+			io1.setInterfaceConnection(ic_);
 			io1.openIO();
 			io1.setTimeout(ic_.t4props_.getNetworkTimeout());
 			io1.setConnectionIdleTimeout(ic_.getConnectionTimeout());
@@ -96,8 +96,7 @@
 			//
 			// io1.setTimeout(ic_.t4props_.getCloseConnectionTimeout());
 			io1.setTimeout(ic_.t4props_.getNetworkTimeout());
-			io1.CloseIO(wbuffer); // Note, we are re-using the wbuffer
-
+			io1.closeIO();
 			return cr1;
 		} // end try
 		catch (SQLException se) {
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Connect.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Connect.java
index 60f3497..2ecf56c 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Connect.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4_Dcs_Connect.java
@@ -61,6 +61,7 @@
 			se.setNextException(se2);
 			throw se;
 		}
+		InputOutput io1 = null;
 		try {
 			LogicalByteArray rbuffer;
 			LogicalByteArray wbuffer;
@@ -72,10 +73,10 @@
 			T4Address address1 = new T4Address(t4props, locale, ic_.getUrl());
 
 			// Open the connection
-			InputOutput io1 = address1.getInputOutput();
-
-			io1.openIO();
+			io1 = address1.getInputOutput();
+                        io1.setInterfaceConnection(ic_);
 			io1.setTimeout(ic_.getLoginTimeout());
+			io1.openIO();
 			io1.setConnectionIdleTimeout(ic_.getConnectionTimeout());
 
 			// Send message to the ODBC Association server.
@@ -86,7 +87,8 @@
 
 			// Close IO
 			io1.setTimeout(ic_.t4props_.getLoginTimeout());
-			io1.CloseIO(wbuffer); // Note, we are re-using the wbuffer
+			io1.closeIO(); // Note, we are re-using the wbuffer
+                        io1 = null;
 
 			String name1 = null;
 			if (address1.m_ipAddress != null) {
@@ -118,6 +120,9 @@
 
 			se.initCause(e);
 			throw se;
+		} finally {
+			if (io1 != null)
+			    io1.closeIO();
 		}
 	}
 }
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java
index 450ee65..21a6923 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java
@@ -1774,38 +1774,8 @@
 
 	boolean erroredConnection = false;
 
-	PreparedStatement[] LobPreparedStatements = new PreparedStatement[14];
-
-	// boolean reserveEmptyDataLocator_ = false;
-	// public static final int EMPTY_DATA_LOCATOR_UPDATE = 0;
-
-	String clobTableName_;
-	String blobTableName_;
-	// String preparedClobTableName_;
-	// String preparedBlobTableName_;
-
-	static final int CLOB_INS_LOB_DATA_STMT = 0;
-	static final int CLOB_GET_LOB_DATA_STMT = 1;
-	static final int CLOB_GET_LOB_LEN_STMT = 2;
-	static final int CLOB_DEL_LOB_DATA_STMT = 3;
-	static final int CLOB_TRUN_LOB_DATA_STMT = 4;
-	static final int CLOB_UPD_LOB_DATA_STMT = 5;
-	static final int CLOB_GET_STRT_DATA_LOC_STMT = 6;
-	static final int BLOB_INS_LOB_DATA_STMT = 7;
-	static final int BLOB_GET_LOB_DATA_STMT = 8;
-	static final int BLOB_GET_LOB_LEN_STMT = 9;
-	static final int BLOB_DEL_LOB_DATA_STMT = 10;
-	static final int BLOB_TRUN_LOB_DATA_STMT = 11;
-	static final int BLOB_UPD_LOB_DATA_STMT = 12;
-	static final int BLOB_GET_STRT_DATA_LOC_STMT = 13;
-
 	static Logger dummyLogger_ = null;
 
-	boolean[] bLobStatementPrepared = new boolean[14]; // initialized to false,
-	// one each for the
-	// BLOB/CLOB statements
-	// listed above
-
 	// Fields
 	InterfaceConnection ic_;
 
@@ -1923,22 +1893,21 @@
 
 	public void abort(Executor executor) throws SQLException {
 		if (ic_.getT4Connection().getInputOutput() != null) {
-			ic_.getT4Connection().getInputOutput().CloseIO(null);
+			ic_.getT4Connection().getInputOutput().closeIO();
 		}
 		ic_.setIsClosed(true);
-		
 	}
 
 	public void setNetworkTimeout(Executor executor, int milliseconds)
 			throws SQLException {
             validateConnection();
-            props_.setNetworkTimeout(milliseconds);
+            props_.setNetworkTimeoutInMillis(milliseconds);
 	}
 	
 
 	public int getNetworkTimeout() throws SQLException {
 		validateConnection();
-		return props_.getNetworkTimeout();
+		return props_.getNetworkTimeoutInMillis();
 	}
 
 	/*
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java
index 4c2b311..683bb04 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java
@@ -500,7 +500,6 @@
 			connection_.props_.getLogWriter().println(temp);
 		}
 		int dataType;
-		long dataLocator;
 
 		validateSetInvocation(parameterIndex);
 
@@ -591,7 +590,6 @@
 			connection_.props_.getLogWriter().println(temp);
 		}
 		int dataType;
-		long dataLocator;
 
 		validateSetInvocation(parameterIndex);
 
@@ -675,7 +673,6 @@
 			connection_.props_.getLogWriter().println(temp);
 		}
 		int dataType;
-		long dataLocator;
 
 		validateSetInvocation(parameterIndex);
 		dataType = inputDesc_[parameterIndex - 1].dataType_;
@@ -809,7 +806,6 @@
 		}
 		char[] value;
 		int dataType;
-		long dataLocator;
 
 		validateSetInvocation(parameterIndex);
 		dataType = inputDesc_[parameterIndex - 1].dataType_;
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java
index d408799..4d1f57e 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java
@@ -83,7 +83,8 @@
 		batchCommands_.add(sql);
 	}
 
-	public void cancel() throws SQLException {
+	public void cancel() throws SQLException 
+        {
 		if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
 			Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
 			connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4Statement", "cancel", "", p);
@@ -97,18 +98,27 @@
 			T4LogFormatter lf = new T4LogFormatter();
 			String temp = lf.format(lr);
 			connection_.props_.getLogWriter().println(temp);
-		}
+        	}
 		// Donot clear warning, since the warning may pertain to
 		// previous opertation and it is not yet seen by the application
 		//
-		// We must decide if this statement is currently being processed or
-		// if it has a result set associated with it, and if that
-		// result set is currently active (i.e. we are fetching rows).
-		if ((ist_.t4statement_ != null && ist_.t4statement_.m_processing == true)
+
+		// if the statement is already closed
+		// No need to cancel the statement
+		
+		if (isClosed_) 
+			return;
+
+		// Check if the statement is stuck in reading from socket connection to mxosrvr
+		// If not, just do the internal close to free up the statement resources on the server side
+		// else let the query time mechanism in the socket connection read take care of 
+		// cancelling the query
+		if ((ist_.getT4statement() != null && (! ist_.getT4statement().isProcessing()))
 				|| (resultSet_ != null && resultSet_[result_set_offset] != null
 						&& resultSet_[result_set_offset].irs_ != null
-						&& resultSet_[result_set_offset].irs_.t4resultSet_ != null && resultSet_[result_set_offset].irs_.t4resultSet_.m_processing == true))
-			ist_.cancel();
+						&& resultSet_[result_set_offset].irs_.t4resultSet_ != null && 
+						( ! resultSet_[result_set_offset].irs_.t4resultSet_.m_processing)))
+			internalClose();
 	}
 
 	public void clearBatch() throws SQLException {
diff --git a/core/conn/jdbc_type2/Makefile b/core/conn/jdbc_type2/Makefile
index 00e8f17..c4b40b5 100644
--- a/core/conn/jdbc_type2/Makefile
+++ b/core/conn/jdbc_type2/Makefile
@@ -46,6 +46,10 @@
        $(OUTDIR)/SQLMXPreparedStatement.o \
        $(OUTDIR)/SQLMXResultSet.o \
        $(OUTDIR)/SQLMXStatement.o \
+       $(OUTDIR)/SQLMXClobReader.o \
+       $(OUTDIR)/SQLMXClobWriter.o \
+       $(OUTDIR)/SQLMXLobInputStream.o \
+       $(OUTDIR)/SQLMXLobOutputStream.o \
        $(OUTDIR)/SrvrJdbcConnect.o \
        $(OUTDIR)/CDesc.o \
        $(OUTDIR)/SrvrCommon.o \
@@ -65,6 +69,10 @@
 		org.apache.trafodion.jdbc.t2.T2Driver \
 		org.apache.trafodion.jdbc.t2.SQLMXPreparedStatement \
 		org.apache.trafodion.jdbc.t2.SQLMXResultSet \
+		org.apache.trafodion.jdbc.t2.SQLMXClobReader \
+		org.apache.trafodion.jdbc.t2.SQLMXClobWriter \
+		org.apache.trafodion.jdbc.t2.SQLMXLobInputStream \
+		org.apache.trafodion.jdbc.t2.SQLMXLobOutputStream \
 		org.apache.trafodion.jdbc.t2.SQLMXStatement
 OBJS = $(COMMON_OBJS) $(T2_OBJS)
 MXODIR = $(TRAF_HOME)/../conn/odbc/src/odbc
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..1262f33 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';
@@ -104,7 +103,6 @@
     IRD = NULL;
     useDefaultDesc = FALSE;
     dialogueId = inDialogueId;
-    nowaitRetcode = SQL_SUCCESS;
     holdability = CLOSE_CURSORS_AT_COMMIT;
     fetchQuadEntries = 0;
     fetchRowsetSize = 0;
@@ -114,7 +112,6 @@
     batchQuadField = NULL;
     inputDescParamOffset = 0;
     batchMaxRowsetSize = 0;
-    stmtInitForNowait = FALSE;
     // +++ T2_REPO
     bLowCost = false;   // May not need this
     m_need_21036_end_msg = false;
@@ -149,28 +146,22 @@
     int retcode;
     cleanupAll();
     inState = STMTSTAT_NONE;
-#ifndef DISABLE_NOWAIT
-    if (stmtInitForNowait) mutexCondDestroy(&cond, &mutex);
-#endif
     FUNCTION_RETURN_VOID((NULL));
 }
 
 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 +256,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 +478,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",
@@ -625,13 +537,6 @@
         // (-104) error.
         threadReturnCode = SQL_RETRY_COMPILE_AGAIN;
         break;
-    case NOWAIT_ERROR:
-        // Allocate Error Desc
-        kdsCreateSQLErrorException(&sqlError, 1);
-        kdsCopySQLErrorException(&sqlError, SQLSVC_EXCEPTION_NOWAIT_ERROR, nowaitRetcode,
-            "HY000");
-        threadReturnCode = SQL_ERROR;
-        break;
     }
     FUNCTION_RETURN_VOID((NULL));
 }
@@ -657,34 +562,14 @@
 
     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);
-
-#ifndef DISABLE_NOWAIT
-    if (rc >= 0)
-        rc = initStmtForNowait(&cond, &mutex);
-    if (rc == 0)
-        stmtInitForNowait = TRUE;
-#endif
-
     CLI_DEBUG_RETURN_SQL(rc);
 }
 
@@ -733,14 +618,6 @@
     isSPJRS = true;
 
     rc = ALLOCSQLMXHDLS_SPJRS(this, callpStmt, RSstmtName);
-
-#ifndef DISABLE_NOWAIT
-    if (rc >= 0)
-        rc = initStmtForNowait(&cond, &mutex);
-    if (rc == 0)
-        stmtInitForNowait = TRUE;
-#endif
-
     CLI_DEBUG_RETURN_SQL(rc);
 }
 
@@ -1103,52 +980,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..93685fa 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)
@@ -114,7 +111,6 @@
     SRVR_DESC_HDL           *IRD;
     BOOL                    useDefaultDesc;
     long                    dialogueId;
-    long                    nowaitRetcode;
     short                   holdability;
     long                    fetchQuadEntries;
     long                    fetchRowsetSize;
@@ -178,7 +174,6 @@
     // T2_REPO
 
     bool isISUD;
-    BOOL                    stmtInitForNowait;
     inline void setSqlQueryStatementType (int Type) {
         SqlQueryStatementType = Type;
     };
@@ -191,9 +186,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 +200,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..992dbad 100644
--- a/core/conn/jdbc_type2/native/CoreCommon.h
+++ b/core/conn/jdbc_type2/native/CoreCommon.h
@@ -278,8 +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_NOWAIT_ERROR   "Error in thread synchronizing functions - Vendor code is FS Error"
+#define SQLSVC_EXCEPTION_PREPARE_FAILED "Error while preparing the query"
 #define SQLSVC_EXCEPTION_INVALID_SCHEMA_VERSION "Invalid Schema version"  // Used for Metadata schemaVersion setup
 
 
@@ -300,7 +299,6 @@
 #define SQL_RETRY_COMPILE_AGAIN     -104
 #define SQL_QUERY_CANCELLED         -105
 #define CANCEL_NOT_POSSIBLE         -106
-#define NOWAIT_ERROR                -107
 #define SQL_RS_DOES_NOT_EXIST       -108
 
 #define TYPE_UNKNOWN                0x0000
@@ -381,13 +379,7 @@
     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;
     char                SystemCatalog[129]; // MX system catalog name
     short               boolFlgforInitialization; // Flag intorduced for Connect/disconnect imp.
 
@@ -461,8 +453,6 @@
 #define SQLCLI_ODBC_MODULE_VERSION 1
 
 
-#define NOWAIT_PENDING      -8002
-
 // Errors returned from SQL_EXEC_AllocStmtForRS()
 #define STMT_ALREADY_EXISTS     -8802
 #define STMT_DOES_NOT_EXIST     -8804
diff --git a/core/conn/jdbc_type2/native/Debug.cpp b/core/conn/jdbc_type2/native/Debug.cpp
index 54f2f57..f6998f2 100644
--- a/core/conn/jdbc_type2/native/Debug.cpp
+++ b/core/conn/jdbc_type2/native/Debug.cpp
@@ -977,38 +977,6 @@
 	return(buffer[curr_idx++]);
 }
 
-void DebugTransTag(const char * filename, unsigned long line)
-{
-	if (DebugActive(DEBUG_LEVEL_TXN,filename,line))
-	{
-		char buffer[256];
-		short status = 0;
-		short length = 0;
-		short txn_status = 0;
-		long long txnId;
-
-		// Get current txn status
-		status = STATUSTRANSACTION(&txn_status);
-		DebugOutput(DebugFormat("status from STATUSTRANSACTION=%d; txn status=%d", txn_status, status),
-					filename, line);
-
-		// Get the transId for the current transaction (if one exists)
-		status = GETTRANSID((short *)&txnId);
-		if (status != 0)
-		{
-			// Report error status and return null
-			DebugOutput(DebugFormat("Status from GETTRANSID = %d", status),
-						filename, line);
-			return;
-		}
-
-		buffer[length] = 0;
-		DebugOutput(DebugFormat("transTagASCII = '%s'", buffer),
-					filename, line);
-		return;
-	}
-}
-
 const char *DebugBoolStr(bool isTrue)
 {
 	if (isTrue) return("TRUE");
diff --git a/core/conn/jdbc_type2/native/GlobalInformation.h b/core/conn/jdbc_type2/native/GlobalInformation.h
index 61d5997..528ec5f 100644
--- a/core/conn/jdbc_type2/native/GlobalInformation.h
+++ b/core/conn/jdbc_type2/native/GlobalInformation.h
@@ -38,7 +38,6 @@
 //	static jboolean			useDefaultEncoding;	// Allows a "default" value for the encoding
 //	static int				totalCharsets;
 //	static jint				defaultCharset;
-//	static short			nowaitFilenum;
 //	static char				NskSystemCatalogName[MAX_NSKCATALOGNAME_LEN+1]; // MP system catalog name
 //	static char				DefaultCatalog[MAX_CHAR_SET_STRING_LENGTH + 1];
 //	static char				DefaultSchema[MAX_CHAR_SET_STRING_LENGTH + 1];
@@ -83,15 +82,6 @@
 	static char *getDefaultSchemaName () {
 		return (DefaultSchema);
 	}
-	
-	inline static void setNoWaitFileNumber (short fileNum) {
-		nowaitFilenum = fileNum;
-		return;
-	}
-	
-	inline static short int getNoWaitFileNumber () {
-		return (nowaitFilenum);
-	}
 */	
 };
 
diff --git a/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp b/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp
index 9373fa1..7c868fc 100644
--- a/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXCallableStatement.cpp
@@ -65,7 +65,6 @@
 	SQLValue_def				sqlString;
 	const char					*nSql = NULL;
 	const char					*nStmtLabel = NULL;
-	short						txn_status;
 
 	ExceptionStruct exception_;
 	CLEAR_EXCEPTION(exception_);
@@ -110,13 +109,6 @@
 		FUNCTION_RETURN_VOID(("stmtLabel 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_Prepare_sme_(NULL, NULL,
 		&exception_,
 		dialogueId,
@@ -134,9 +126,7 @@
 		&outputDesc,
 		&sqlWarning,
 		&stmtId,
-		&inputParamOffset,
-		NULL, // MFC
-		false);
+		&inputParamOffset);
 
 	if (sql)
 	{
@@ -146,13 +136,6 @@
 	if (stmtLabel)
 		JNI_ReleaseStringUTFChars(jenv,stmtLabel, nStmtLabel);
 
-	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:
@@ -204,7 +187,6 @@
 	jint							externalTxid = 0;
 	short							returnResultSet;
 	long							sqlcode;
-	short							txn_status;
 
 	SQLValueList_def				inputSqlValueList;
 	CLEAR_LIST(inputSqlValueList);
@@ -226,13 +208,6 @@
 		0, 1, paramCount, paramValues, iso88591Encoding))
 		FUNCTION_RETURN_VOID(("fillInSQLValues() Failed"));
 
-	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_ExecuteCall_sme_(NULL, NULL,
 		&exception_,
 		dialogueId,
@@ -244,14 +219,6 @@
 		&returnResultSet,
 		&sqlWarning);
 
-	if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, exception_.exception_nr,
-		pSrvrStmt->isSPJRS, txnMode, externalTxid)) != 0)
-	{
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwTransactionException(jenv, txn_status);
-		DEBUG_OUT(DEBUG_LEVEL_ENTRY,("endTxnControl() Failed"));
-	}
-
 	switch (exception_.exception_nr)
 	{
 	case CEE_SUCCESS:
@@ -293,116 +260,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/SQLMXClobReader.cpp b/core/conn/jdbc_type2/native/SQLMXClobReader.cpp
new file mode 100644
index 0000000..82ff81b
--- /dev/null
+++ b/core/conn/jdbc_type2/native/SQLMXClobReader.cpp
@@ -0,0 +1,68 @@
+/**************************************************************************
+ // @@@ START COPYRIGHT @@@
+ //
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements.  See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership.  The ASF licenses this file
+ // to you under the Apache License, Version 2.0 (the
+ // "License"); you may not use this file except in compliance
+ // with the License.  You may obtain a copy of the License at
+ //
+ //   http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied.  See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ //
+ // @@@ END COPYRIGHT @@@
+ **************************************************************************/
+//
+// MODULE: SQLMXClobReader.cpp
+//
+#include <platform_ndcs.h>
+#include <sql.h>
+#include <sqlext.h>
+#include "JdbcDriverGlobal.h"
+#include "org_apache_trafodion_jdbc_t2_SQLMXClobReader.h"
+#include "SQLMXCommonFunctions.h"
+#include "CoreCommon.h"
+#include "SrvrCommon.h"
+#include "SrvrOthers.h"
+#include "CSrvrConnect.h"
+#include "Debug.h"
+#include "GlobalInformation.h"
+#include "sqlcli.h"
+
+JNIEXPORT jint JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXClobReader_readChunk
+  (JNIEnv *jenv, jobject jobj, jstring jServer, jlong jDialogueId, jint jExtractMode, jstring jLobLocator, jobject jCharBuffer)
+{
+   odbc_SQLsrvr_ExtractLob_exc_ exception = {0,0,0};
+   BYTE *chunkBuf = (BYTE *)jenv->GetDirectBufferAddress(jCharBuffer);
+   jlong jLength = jenv->GetDirectBufferCapacity(jCharBuffer);
+   const char *lobLocator = jenv->GetStringUTFChars(jLobLocator, NULL);
+   IDL_long_long  lobLength = 0; // Used when extractMode is 0 
+   IDL_long_long  extractLen = jLength;
+
+   odbc_SQLSrvr_ExtractLob_sme_(NULL, NULL, &exception, jDialogueId, jExtractMode, 
+                (IDL_char *)lobLocator, lobLength, extractLen, chunkBuf);
+   jenv->ReleaseStringUTFChars(jLobLocator, lobLocator);
+   switch (exception.exception_nr) {
+      case CEE_SUCCESS:
+         return extractLen;
+      case odbc_SQLSvc_ExtractLob_SQLError_exn_:
+         throwSQLException(jenv, &exception.u.SQLError);
+         break;
+      case odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_:
+         throwSQLException(jenv, MODULE_ERROR, exception.u.ParamError.ParamDesc, "HY000");
+         break;
+      case odbc_SQLSvc_ExtractLob_InvalidConnect_exn_:
+      default:
+         throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception.exception_nr);
+         break;
+   }
+   return -1;
+}
diff --git a/core/conn/jdbc_type2/native/SQLMXClobWriter.cpp b/core/conn/jdbc_type2/native/SQLMXClobWriter.cpp
new file mode 100644
index 0000000..b664663
--- /dev/null
+++ b/core/conn/jdbc_type2/native/SQLMXClobWriter.cpp
@@ -0,0 +1,68 @@
+/**************************************************************************
+ // @@@ START COPYRIGHT @@@
+ //
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements.  See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership.  The ASF licenses this file
+ // to you under the Apache License, Version 2.0 (the
+ // "License"); you may not use this file except in compliance
+ // with the License.  You may obtain a copy of the License at
+ //
+ //   http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied.  See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ //
+ // @@@ END COPYRIGHT @@@
+ **************************************************************************/
+//
+// MODULE: SQLMXClobWriter.cpp
+//
+#include <platform_ndcs.h>
+#include <sql.h>
+#include <sqlext.h>
+#include "JdbcDriverGlobal.h"
+#include "org_apache_trafodion_jdbc_t2_SQLMXClobWriter.h"
+#include "SQLMXCommonFunctions.h"
+#include "CoreCommon.h"
+#include "SrvrCommon.h"
+#include "SrvrOthers.h"
+#include "CSrvrConnect.h"
+#include "Debug.h"
+#include "GlobalInformation.h"
+#include "sqlcli.h"
+
+JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXClobWriter_writeChunk
+  (JNIEnv *jenv, jobject jobj, jstring jServer, jlong jDialogueId, jlong jTxId, jstring jLobLocator, jstring jChunk, jlong jPos)
+{
+   odbc_SQLSvc_UpdateLob_exc_ exception = {0,0,0};
+   const char *chunkStr = jenv->GetStringUTFChars(jChunk, NULL);
+   long chunkLen = jenv->GetStringUTFLength(jChunk);
+   const char *lobLocator = jenv->GetStringUTFChars(jLobLocator, NULL);
+
+   odbc_SQLSrvr_UpdateLob_sme_(NULL, NULL, &exception, jDialogueId, 
+                (IDL_char *)lobLocator, 0, jPos, chunkLen, (BYTE *)chunkStr);
+   jenv->ReleaseStringUTFChars(jLobLocator, lobLocator);
+   jenv->ReleaseStringUTFChars(jChunk, chunkStr);
+   switch (exception.exception_nr) {
+      case CEE_SUCCESS:
+         break;
+      case odbc_SQLSvc_UpdateLob_SQLError_exn_:
+         throwSQLException(jenv, &exception.u.SQLError);
+         break;
+      case odbc_SQLSvc_UpdateLob_ParamError_exn_:
+      case odbc_SQLSvc_UpdateLob_SQLInvalidhandle_exn_:
+         throwSQLException(jenv, MODULE_ERROR, exception.u.ParamError.ParamDesc, "HY000");
+         break;
+      case odbc_SQLSvc_UpdateLob_InvalidConnect_exn_:
+      default:
+         throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception.exception_nr);
+         break;
+   }
+   return ;
+}
diff --git a/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp b/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp
index 9151076..9da7e44 100644
--- a/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp
@@ -1611,6 +1611,8 @@
 						case SQLTYPECODE_VARCHAR_LONG:
 						case SQLTYPECODE_DATETIME:
 						case SQLTYPECODE_INTERVAL:
+						case SQLTYPECODE_CLOB:
+						case SQLTYPECODE_BLOB:
 							if ((IPD[paramNumber + paramOffset].vc_ind_length == 4) && (allocLength > dataLen + sizeof(int)))
 							{
 							    *(unsigned int *)dataPtr = (int)dataLen;
@@ -1738,7 +1740,6 @@
 			FUNCTION_RETURN_NUMERIC(FALSE,("parameter is NULL"));
 		}
 
-		// Linux port- moving here from case block because of compile errors
 		jbyteArray bigNumAsBytes;
 		jint bytesLength;
 		BYTE *pB;
@@ -1749,7 +1750,8 @@
 		case SQLTYPECODE_VARCHAR:
 		case SQLTYPECODE_VARCHAR_LONG:
 		case SQLTYPECODE_VARCHAR_WITH_LENGTH:
-
+		case SQLTYPECODE_CLOB:
+		case SQLTYPECODE_BLOB:		
 			if ( useDefaultCharsetEncoding(wrapperInfo->jenv, jobj, charSet, iso88591Encoding) )
 			{
 				encoding = NULL;
@@ -2022,6 +2024,8 @@
 			break;
 		case SQLTYPECODE_VARCHAR_WITH_LENGTH:
 		case SQLTYPECODE_VARCHAR_LONG:
+		case SQLTYPECODE_CLOB:
+		case SQLTYPECODE_BLOB:
 		case SQLTYPECODE_DATETIME:
 		case SQLTYPECODE_INTERVAL:
 			if (vcIndLength == 4 && targetLength > dataLen+sizeof(int))
@@ -2101,6 +2105,8 @@
 		case SQLTYPECODE_VARCHAR:
 		case SQLTYPECODE_VARCHAR_LONG:
 		case SQLTYPECODE_VARCHAR_WITH_LENGTH:
+		case SQLTYPECODE_CLOB:
+		case SQLTYPECODE_BLOB:
 			if (nParamValue != NULL)
 			{
 				JNI_ReleaseByteArrayElements(wrapperInfo->jenv,stringByteArray, (jbyte *)nParamValue, JNI_ABORT);
@@ -2146,7 +2152,6 @@
 		jint							externalTxid;
 		SRVR_STMT_HDL					*pSrvrStmt;
 		long							sqlcode;
-		short							txn_status;
 
 		//intialize exception_ structure, so that if catalog api run successfully, there is no exception
 		memset((void*)&exception_,0,sizeof(ExceptionStruct));
@@ -2201,13 +2206,6 @@
 		else
 			nfkTableNm = "";
 
-		if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1)) != 0)
-		{
-			jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidDBMMethodId, currentTxid);
-			throwTransactionException(jenv, txn_status);
-			FUNCTION_RETURN_PTR(NULL,("beginTxnControl() failed"));
-		}
-
 		// Null out outputValueList before we pass it down
 		CLEAR_LIST(outputValueList);
 
@@ -2260,13 +2258,6 @@
 
 		if (fktableNm)
 			JNI_ReleaseStringUTFChars(jenv,fktableNm, nfkTableNm);
-		if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit,
-			exception_.exception_nr, TRUE, txnMode, externalTxid)) != 0)
-		{
-			jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidDBMMethodId, currentTxid);
-			throwTransactionException(jenv, txn_status);
-			FUNCTION_RETURN_PTR(NULL,("endTxnControl() Failed"));
-		}
 
 		switch (exception_.exception_nr)
 		{
@@ -2325,503 +2316,34 @@
 		}
 	}
 
-	short suspendExtTxn(jint &externalTxid)
-	{
-/*
-		FUNCTION_ENTRY("suspendExtTxn",
-			("externalTxid=0x%08x",
-			externalTxid));
-			
-		short	exttxnhandle[10];
-		short	status = 0;
+        void throwTransactionException(JNIEnv *jenv, jint err_code)	
+	{	
+		FUNCTION_ENTRY("throwTransactionException",("jenv=0x%08x, err_code=%ld",	
+			jenv, err_code));	
 
-#ifndef NSK_PLATFORM	// Linux port - ToDo txn related
-		return 0;
-#else		
-		// Get txn handle within current thread
-		status = TMF_GETTXHANDLE_((short *)&exttxnhandle);
-		DEBUG_OUT(DEBUG_LEVEL_TXN,("TMF_GETTXHANDLE_() returned %d", status));
-		if (status != 0)
-			FUNCTION_RETURN_NUMERIC(status,("TMF_GETTXHANDLE_ returned error"));
+		char msg[100];	
 
-		// Get "txn-begin-tag" from txn handle
-		#ifdef _LP64
-		status = TMF_BEGINTAG_FROM_TXHANDLE_(exttxnhandle, ( __int32_t _ptr32 *) &externalTxid); //venu type casted this pointer
-		#else
-			status = TMF_BEGINTAG_FROM_TXHANDLE_(exttxnhandle, &externalTxid);
-		#endif
-		DEBUG_OUT(DEBUG_LEVEL_TXN,("TMF_BEGINTAG_FROM_TXHANDLE_() returned %d; externalTxid = 0x%08x", status, (long *)externalTxid));
-		if (status != 0)
-			FUNCTION_RETURN_NUMERIC(status,("TMF_BEGINTAG_FROM_TXHANDLE_ returned error"));
-#endif		
-		status = resumeTransaction(0);
-		DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0x%08x) returned %d", externalTxid, status));
-
-		FUNCTION_RETURN_NUMERIC(status,(NULL));
-*/
-               return 0;
+		if (err_code > 0)	
+		{	
+			sprintf(msg,"error %d",err_code);	
+			throwSQLException(jenv, TMF_ERROR, msg, "HY000", 0);	
+		}	
+		else	
+		{	
+			switch (err_code)	
+			{	
+			case INVALID_TRANSACTION_STATE:	
+				throwSQLException(jenv, INCONSISTENT_TRANSACTION_ERROR, NULL, "25000", 0);	
+				break;	
+				// This exception should never be thrown	
+			default:	
+				throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", 0);	
+				break;	
+			}	
+		}	
+		FUNCTION_RETURN_VOID((NULL));	
 	}
 
-	short resumeOrBeginTxn(JNIEnv *jenv, jint &currentTxid, jint &externalTxid, jint txnMode)
-	{
-/*
-		FUNCTION_ENTRY("resumeOrBeginTxn",("jenv=0x%08x, currentTxid=0x%08x, externalTxid=0x%08x, txnMode=%ld,",
-			jenv,
-			currentTxid,
-			externalTxid,
-			txnMode));
-
-		short status;
-		
-#ifndef NSK_PLATFORM	// Linux port - ToDo txn related
-		return 0;
-#else				
-		short txid[4];
-		long *txid_ptr;;
-		txid_ptr = (long *)&txid[0];
-
-		externalTxid = 0;
-
-		status = GETTRANSID((short *)&txid);
-		txid[3]=0;
-
-		DEBUG_OUT(DEBUG_LEVEL_TXN,("GETTRANSID() returned %d ; trans-begin-tag = 0x%08x", status, *txid_ptr));
-
-		switch (status)
-		{
-			// Zero indicates that there is a TMF transaction on the current thread
-		case 0:
-			// Display internal and external form of the transaction tag for debug purposes
-			DEBUG_OUT(DEBUG_LEVEL_TXN, ("currentTxid = 0x%08x", currentTxid));
-			DEBUG_TRANSTAG();
-
-			if (currentTxid != 0)
-			{
-				status = INVALID_TRANSACTION_STATE;
-				FUNCTION_RETURN_NUMERIC(status,("currentTxid != 0"));
-			}
-			// suspend external txn when in "internal" txn mode
-			if (txnMode == org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_INTERNAL)
-			{
-				if ((status = suspendExtTxn(externalTxid)) != 0)
-					FUNCTION_RETURN_NUMERIC(status,
-					("Failed to suspend external txn -- ext txnId = 0x%08x", externalTxid));
-				// continue processing to the next case to either begin a new txn or resume the current txn
-			}
-			else
-			{
-				// Set external txid to a non-zero value to indicate an external txn is in progress
-				// and break from switch
-				externalTxid = -1;
-				break;
-			}
-
-		case 75: // Nil State Transaction
-        case 78: //Added for R3.0,incase of a invalid transaction also begin a transaction -senthil
-			if (currentTxid == 0)
-			{
-				status = beginTransaction((long *)&currentTxid);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("beginTransaction(0x%08x) returned %d",
-					currentTxid,
-					status));
-			}
-			else
-			{
-				status = resumeTransaction(currentTxid);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0x%08x) returned %d",
-					currentTxid,
-					status));
-				switch (status)
-				{
-				case 0:
-					break;
-					// Note: Per TMF Application Programmer's Guide - Do not need call abortTransaction() or endTransaction()
-					//       for the following three error codes.
-				case 31: // Unable to obtain file-system buffer space
-				case 36: // Unable to lock physical memory; not enough memory available
-				case 78: // Invalid txn id
-					currentTxid = 0;
-					break;
-					/*For 10-091005-5100, Just pass back the error 97*/
-/*
-				case 97: // CONTROL QUERY DEFAULT DOOM_USERTRANSACTION 'ON'
-					break;
-				default:
-					short rc = abortTransaction();
-					DEBUG_OUT(DEBUG_LEVEL_TXN,("abortTransaction() returned %d (Not handled)",
-						rc));
-					currentTxid = 0;
-				}
-			}
-			break;
-		default:
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("GETTRANSID() returned %d (default case)", status));
-		}
-#endif		
-		FUNCTION_RETURN_NUMERIC(status,(NULL));
-*/
-               return 0;
-	}
-
-	short resumeTxn(JNIEnv *jenv, jint &currentTxid, jint &externalTxid, jint txnMode)
-	{
-/*
-		FUNCTION_ENTRY("resumeTxn",("jenv=0x%08x, currentTxid=0x%08x, externalTxid=0x%08x",
-			jenv,
-			currentTxid,
-			externalTxid));
-
-		short status;
-		
-#ifndef NSK_PLATFORM	// Linux port - ToDo txn related
-		return 0;
-#else				
-		short txid[4];
-		long *txid_ptr;;
-		txid_ptr = (long *)&txid[0];
-
-		externalTxid = 0;
-
-		status = GETTRANSID((short *)&txid);
-		txid[3]=0;
-
-		DEBUG_OUT(DEBUG_LEVEL_TXN,("GETTRANSID() returned %d ; trans-begin-tag = 0x%08x", status, *txid_ptr));
-
-		switch (status)
-		{
-		case 0:
-			// Display internal and external form of the transaction tag for debug purposes
-			DEBUG_OUT(DEBUG_LEVEL_TXN, ("currentTxid = 0x%08x", currentTxid));
-			DEBUG_TRANSTAG();
-
-			// If there is any txid in the Connection Context, throw error (mixed mode only)
-			if (currentTxid != 0)
-			{
-				status = INVALID_TRANSACTION_STATE;
-				FUNCTION_RETURN_NUMERIC(status,("Invalid transaction state -- currentTxid != 0 "));
-			}
-			// suspend external txn when in "internal" txn mode
-			if (txnMode == org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_INTERNAL)
-			{
-				if ((status = suspendExtTxn(externalTxid)) != 0)
-				{
-					DEBUG_OUT(DEBUG_LEVEL_TXN,("suspendExtTxn returned ext txn = 0x%08x", externalTxid));
-					FUNCTION_RETURN_NUMERIC(status,("Failed to suspend external txn or get external txid."));
-				}
-			}
-			else
-			{
-				// Set external txid to a non-zero value to indicate an external txn is in progress
-				// and break from switch
-				externalTxid = -1;
-				break;
-			}
-		case 75: // Nil State Transaction
-			case 78: //Added for R3.0,incase of a invalid transaction also begin a transaction -senthil
-			status = resumeTransaction(currentTxid);
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0x%08x) returned %d",
-				currentTxid, status));
-			switch (status)
-			{
-			case 0:
-				break;
-				// Note: Per TMF Application Programmer's Guide - Do not need call abortTransaction() or endTransaction()
-				//       for the following three error codes.
-			case 31:  // Unable to obtain file-system buffer space
-			case 36:  // Unable to lock physical memory; not enough memory available
-			case 78:  // Invalid txn id
-				currentTxid = 0;
-				break;
-			default:
-				short rc = abortTransaction();
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("abortTransaction() returned %d (Not handled)",
-					rc));
-				currentTxid = 0;
-			}
-			break;
-		default:
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("GETTRANSID() returned %d (default case)", status));
-		}
-#endif		
-		FUNCTION_RETURN_NUMERIC(status,(NULL));
-*/
-		return 0;
-	}
-
-	short suspendOrEndTxn(JNIEnv *jenv, jint &currentTxid,
-		jboolean autoCommit, unsigned long exception_nr,
-		jboolean isSelect)
-	{
-/*
-		FUNCTION_ENTRY("suspendOrEndTxn",("jenv=0x%08x, currentTxid=0x%08x, autoCommit=%s, exception_nr=%ld, isSelect=%s",
-			jenv,
-			currentTxid,
-			DebugBoolStr(autoCommit),
-			exception_nr,
-			DebugBoolStr(isSelect)));
-
-		short status = 0;
-
-		// Abort the transaction independent of autoCommit mode
-		// to ensure the database is consistent
-		// - Ask SQL folks to verify
-		if ((exception_nr != CEE_SUCCESS) && (! isSelect))
-		{
-			short rc = abortTransaction();
-			// Ignore any error from ABORT, since SQL might have also aborted
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("abortTransaction() returned %d (Ignored)",
-				rc));
-			currentTxid = 0;
-			FUNCTION_RETURN_NUMERIC(status,(NULL));
-		}
-		if (autoCommit)
-		{
-			if (! isSelect)
-			{
-				status = endTransaction();
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("endTransaction() returned %d",
-					status));
-				currentTxid = 0;
-			}
-			else
-			{
-				status = resumeTransaction(0);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0) returned %d",
-					status));
-			}
-		}
-		else
-		{
-			status = resumeTransaction(0);
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0) returned %d",
-				status));
-		}
-		FUNCTION_RETURN_NUMERIC(status,(NULL));
-*/
-                return 0;
-	}
-
-
-
-	short suspendOrEndTxn(JNIEnv *jenv, jint &currentTxid,
-		jint previousTxid, jboolean autoCommit,
-		unsigned long exception_nr, jboolean isSelect)
-	{
-/*
-		FUNCTION_ENTRY("suspendOrEndTxn",
-			("jenv=0x%08x, currentTxid=0x%08x, previousTxid=0x%08x, autoCommit=%s, exception_nr=%ld, isSelect=%s",
-			jenv,
-			currentTxid,
-			previousTxid,
-			DebugBoolStr(autoCommit),
-			exception_nr,
-			DebugBoolStr(isSelect)));
-
-		short status = 0;
-
-		/* 
-		* Description: Type 2 driver now supports atomicity at statement level
-		*/
-/*
-		if (previousTxid) // Transaction was already started by the previous SQL execution
-		{
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("previous txn (0x%08x) in progres",previousTxid));
-			if (!autoCommit )
-			{
-				if((STMT_ATOMICITY == true) || (exception_nr == CEE_SUCCESS) || (isSelect))
-				{
-					//Always suspend the txn if STMT_ATOMICITY is true
-					status = resumeTransaction(0);
-					DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0) returned %d", status));
-				}
-				else
-				{
-					/*10-091005-5100: Whenever the user has started the txn
-					* dont abort it just resume it as above.
-					*/
-/*
-					status = resumeTransaction(0);
-					DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0) returned %d", status));
-					/*Commented for 10-091005-5100*/
-					//short rc = abortTransaction();
-					// Ignore any error from ABORT, since SQL might have also aborted
-					//DEBUG_OUT(DEBUG_LEVEL_TXN,("abortTransaction() returned %d (Ignored)", rc));
-					//currentTxid = 0;
-					/*Commented for 10-091005-5100*/
-/*
-				}
-			}
-			// Resume txn if cmd passed OR it failed and it is a select
-			else if ( (exception_nr == CEE_SUCCESS) || ((exception_nr != CEE_SUCCESS) && (isSelect)) )
-			{
-				status = resumeTransaction(0);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("resumeTransaction(0) returned %d", status));
-			}
-			// abort the txn if cmd failed and it is not a select
-			else // the only other possible option is ==> ((exception_nr != CEE_SUCCESS) && (!isSelect))
-			{
-				// Abort the transaction (independent of autoCommit mode)
-				// just to make sure the database is consistent
-				//   Note: Ask SQL folks to verify
-				short rc = abortTransaction();
-				// Ignore any error from ABORT, since SQL might have also aborted
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("abortTransaction() returned %d (Ignored)", rc));
-				currentTxid = 0;
-			}
-		}
-		else
-		{
-			status = suspendOrEndTxn(jenv, currentTxid, autoCommit, exception_nr, isSelect);
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("suspendOrEndTxn returned %d : currentTxid = 0x%08x, autoCommit = %s ",
-				status, currentTxid, DebugBoolStr(autoCommit)));
-		}
-		FUNCTION_RETURN_NUMERIC(status,(NULL));
-*/
-		return 0;
-	}
-
-	short beginTxnControl(JNIEnv *jenv, jint &currentTxid, jint &externalTxid, jint txnMode, jint holdability)
-	{
-/*
-		FUNCTION_ENTRY("beginTxnControl",("jenv=0x%08x, currentTxid=0x%08x, externalTxid=0x%08x, txnMode=%ld, holdability=%ld",
-			jenv,
-			currentTxid,
-			externalTxid,
-			txnMode,
-			holdability));
-
-		short status = 0;
-
-		switch (txnMode)
-		{
-		case org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_INTERNAL:
-		case org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_MIXED:
-			if (holdability == CLOSE_CURSORS_AT_COMMIT)
-			{
-				status = resumeTxn(jenv, currentTxid, externalTxid, txnMode);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,(
-					"beginTxnControl -- resumeTxn returned %d currentTxid = 0x%08x",
-					status, currentTxid));
-			}
-			else
-			{
-				status = resumeOrBeginTxn(jenv, currentTxid, externalTxid, txnMode);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,(
-					"beginTxnControl -- resumeOrBeginTxn returned %d currentTxid = 0x%08x",
-					status, currentTxid));
-			}
-			break;
-		case org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_EXTERNAL:
-			break;
-		default:
-			// This is a programming error if it ever gets to hers
-			status = -2;
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("Invalid txn mode"));
-		}
-		FUNCTION_RETURN_NUMERIC(status,(NULL));
-*/
-		return 0;
-	}
-
-	void throwTransactionException(JNIEnv *jenv, jint err_code)
-	{
-		FUNCTION_ENTRY("throwTransactionException",("jenv=0x%08x, err_code=%ld",
-			jenv, err_code));
-
-		char msg[100];
-
-		if (err_code > 0)
-		{
-			sprintf(msg,"error %d",err_code);
-			throwSQLException(jenv, TMF_ERROR, msg, "HY000", 0);
-		}
-		else
-		{
-			switch (err_code)
-			{
-			case INVALID_TRANSACTION_STATE:
-				throwSQLException(jenv, INCONSISTENT_TRANSACTION_ERROR, NULL, "25000", 0);
-				break;
-				// This exception should never be thrown
-			default:
-				throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", 0);
-				break;
-			}
-		}
-		FUNCTION_RETURN_VOID((NULL));
-	}
-
-	short endTxnControl(JNIEnv *jenv, jint &currentTxid, jint txid,
-		jboolean autoCommit, unsigned long exception_nr, jboolean isSelect,
-		jint txnMode, jint &externalTxid)
-	{
-/*
-		FUNCTION_ENTRY("endTxnControl",("jenv=0x%08x, currentTxid=0x%08x, txid=0x%08x, autoCommit=%s, exception_nr=%ld, isSelect=%s, txnMode=%ld, externalTxid=0x%08x",
-			jenv,
-			currentTxid,
-			txid,
-			DebugBoolStr(autoCommit),
-			exception_nr,
-			DebugBoolStr(isSelect),
-			txnMode,
-			externalTxid));
-
-		short status = 0;
-		switch (txnMode)
-		{
-		case org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_INTERNAL:
-			status = suspendOrEndTxn(jenv, currentTxid, txid, autoCommit, exception_nr, isSelect);
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("suspendOrEndTxn returned %d for currentTxid 0x%08x , txid = 0x%08x",
-				status, currentTxid, txid));
-			if (status != 0)
-				FUNCTION_RETURN_NUMERIC(status,("suspendOrEndTxn() failed"));
-
-			// resume external txn if one existed
-			if (externalTxid != 0)
-			{
-				status = resumeTransaction(externalTxid);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("Resuming ext txn -- resumeTransaction(0x%08x) returned %d",
-					externalTxid, status));
-				switch (status)
-				{
-				case 0:
-					break;
-					// Note: Per TMF Application Programmer's Guide - Do not need call abortTransaction() or endTransaction()
-					//       for the following three error codes.
-				case 31:  // Unable to obtain file-system buffer space
-				case 36:  // Unable to lock physical memory; not enough memory available
-				case 78:  // Invalid txn id
-					externalTxid = 0;
-					break;
-				default:
-					short rc = abortTransaction();
-					DEBUG_OUT(DEBUG_LEVEL_TXN,("abortTransaction() returned %d (Not handled)",
-						rc));
-					externalTxid = 0;
-				}
-			}
-			break;
-		case org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_MIXED:
-			if (externalTxid == 0)
-			{
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("Not an external txn: currentTxid = 0x%08x, txid = 0x%08x", currentTxid, txid));
-				status = suspendOrEndTxn(jenv, currentTxid, txid, autoCommit, exception_nr, isSelect);
-				DEBUG_OUT(DEBUG_LEVEL_TXN,("suspendOrEndTxn returned %d for currentTxid (0x%08x)", status, currentTxid));
-			}
-			break;
-		case org_apache_trafodion_jdbc_t2_SQLMXConnection_TXN_MODE_EXTERNAL:
-			break;
-		default:
-			// This is a programming error if it ever gets to hers
-			status = -2;
-			DEBUG_OUT(DEBUG_LEVEL_TXN,("Invalid txn mode"));
-		}
-		FUNCTION_RETURN_NUMERIC(status,(NULL));
-*/
-		return 0;
-	}
-
-
 	BOOL cacheJNIObjects(JNIEnv *jenv)
 	{
 		FUNCTION_ENTRY("cacheJNIObjects",("jenv=0x%08x",
@@ -3199,7 +2721,6 @@
 		IRD = pSrvrStmt->IRD;
 		scale = IRD[columnIndex].scale;
 
-		// Linux port- moving here from case block because of compile errors
 		const char *bigNum;
 		jstring bigNumAsString;
 		jbyteArray columnValue;
@@ -3232,6 +2753,15 @@
 				*(strDataPtr + DataLen) = '\0';
 			usejchar = TRUE;
 			break;
+		case SQLTYPECODE_CLOB:
+		case SQLTYPECODE_BLOB:
+			strDataPtr = (char *)SQLValue->dataValue._buffer + sizeof(short);
+			DataLen = *(short *)SQLValue->dataValue._buffer;
+			// Null terminate only if ISO88591
+			if(nullRequired(SQLValue->dataCharset))
+				*(strDataPtr + DataLen) = '\0';
+			usejchar = TRUE;
+			break;
 		case SQLTYPECODE_VARCHAR_WITH_LENGTH:
 		case SQLTYPECODE_VARCHAR_LONG:
 		case SQLTYPECODE_INTERVAL:
diff --git a/core/conn/jdbc_type2/native/SQLMXCommonFunctions.h b/core/conn/jdbc_type2/native/SQLMXCommonFunctions.h
index 4f9523f..4fc61b2 100644
--- a/core/conn/jdbc_type2/native/SQLMXCommonFunctions.h
+++ b/core/conn/jdbc_type2/native/SQLMXCommonFunctions.h
@@ -147,9 +147,6 @@
 			long uniqueness, jint accuracy, jshort sqlType, jint metadataId,
 			jstring fkcatalogNm, jstring fkschemaNm, jstring fktableNm);
 
-extern short beginTxnControl(JNIEnv *jenv, jint &currentTxid, jint &externalTxid, jint txnMode, jint holdability);
-extern short endTxnControl(JNIEnv *jenv, jint &currentTxid, jint previousTxid, jboolean autoCommit, unsigned long exception_nr, 
-							jboolean isSelect, jint txnMode, jint &externalTxid);
 
 extern void throwTransactionException(JNIEnv *jenv, jint error_code);
 
diff --git a/core/conn/jdbc_type2/native/SQLMXConnection.cpp b/core/conn/jdbc_type2/native/SQLMXConnection.cpp
index 11758d4..67bdded 100644
--- a/core/conn/jdbc_type2/native/SQLMXConnection.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXConnection.cpp
@@ -64,6 +64,9 @@
     FUNCTION_RETURN_VOID((NULL));
 }
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_setCatalog
 (JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId, jstring catalog)
 {
@@ -380,8 +383,8 @@
 
 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,
+        jstring schema, jboolean isReadOnly, jboolean autoCommit, jint transactionIsolation,
+        jint loginTimeout, jint queryTimeout, 
         jint statisticsIntervalTime, jint statisticsLimitTime, jstring statisticsType, jstring programStatisticsEnabled, jstring statisticsSqlPlanEnabled)
 {
 
@@ -394,8 +397,6 @@
                     DebugJString(jenv,catalog)));
     DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  schema=%s",
                     DebugJString(jenv,schema)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  mploc=%s",
-                    DebugJString(jenv,mploc)));
     DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  isReadOnly=%d, transactionIsolation=%ld",
                     isReadOnly,
                     transactionIsolation));
@@ -410,21 +411,10 @@
                     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;
@@ -459,8 +449,6 @@
     nCatalog = JNI_GetStringUTFChars(jenv,catalog, NULL);
     if (schema)
     nSchema = JNI_GetStringUTFChars(jenv,schema, NULL);
-    if (mploc)
-    nMploc = JNI_GetStringUTFChars(jenv,mploc, NULL);
 
     odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
             &setConnectException,
@@ -495,70 +483,6 @@
     // new code end
 #endif /* NOT NEEDED with improvements to Native Expressions code */
 
-    if (srvrGlobal->nowaitOn == 2)
-    {
-        odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
-                &setConnectException,
-                dialogueId,
-                SET_OLT_QUERY_OPT,
-                0,
-                NULL,
-                &sqlWarning);
-        if (setConnectException.exception_nr != CEE_SUCCESS)
-        {
-            throwSetConnectionException(jenv, &setConnectException);
-            FUNCTION_RETURN_VOID(("SET_OLT_QUERY_OPT - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                            CliDebugSqlError(setConnectException.exception_nr)));
-        }
-    }
-
-    if (mploc)
-    {
-        //Solution 10-120315-2068 --- start
-        /*
-         The SET NAMETYPE statement sets the NAMETYPE attribute value for the current
-         SQL session.
-         The SET NAMETYPE statement sets the NAMETYPE attribute for all dynamic
-         statements within the control flow scope of an embedded SQL program for the current
-         SQL session.
-         SET NAMETYPE is an SQL/MX extension.
-         ANSI | NSK
-         specifies whether the system assumes logical names (ANSI) or physical Guardian
-         names (NSK) are used to reference SQL/MP database objects in SQL statements
-         */
-        odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
-                &setConnectException,
-                dialogueId,
-                SET_NAMETYPE,
-                0,
-                "NSK",
-                &sqlWarning);
-        if (setConnectException.exception_nr != CEE_SUCCESS)
-        {
-            throwSetConnectionException(jenv, &setConnectException);
-            FUNCTION_RETURN_VOID(("SET_MPLOC - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                            CliDebugSqlError(setConnectException.exception_nr)));
-        }
-
-        //Solution 10-120315-2068 --- end
-
-        odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
-                &setConnectException,
-                dialogueId,
-                SET_MPLOC,
-                0,
-                (char *)nMploc,
-                &sqlWarning);
-        JNI_ReleaseStringUTFChars(jenv,mploc, nMploc);
-
-        if (setConnectException.exception_nr != CEE_SUCCESS)
-        {
-            throwSetConnectionException(jenv, &setConnectException);
-            FUNCTION_RETURN_VOID(("SET_MPLOC - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                            CliDebugSqlError(setConnectException.exception_nr)));
-        }
-    }
-
     if (catalog)
     {
         odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
@@ -621,24 +545,6 @@
                         CliDebugSqlError(setConnectException.exception_nr)));
     }
 
-    if(blnDoomUsrTxn)
-    {
-
-        odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
-                &setConnectException,
-                dialogueId,
-                CQD_DOOM_USER_TXN,
-                0,
-                NULL,
-                &sqlWarning);
-        if (setConnectException.exception_nr != CEE_SUCCESS)
-        {
-            throwSetConnectionException(jenv, &setConnectException);
-            FUNCTION_RETURN_VOID(("CQD_DOOM_USER_TXN - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                            CliDebugSqlError(setConnectException.exception_nr)));
-        }
-    }
-
     odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
             &setConnectException,
             dialogueId,
@@ -670,40 +576,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);
@@ -820,7 +692,7 @@
 
 JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connectReuse
 (JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId, jint conReuseBitMap, jstring catalog,
-        jstring schema, jstring mploc, jint transactionIsolation)
+        jstring schema, jint transactionIsolation)
 {
     FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connectReuse",("..."));
     DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  jenv=0x%08x, server=%s, dialogueId=0x%08x",
@@ -833,14 +705,11 @@
                     DebugJString(jenv,catalog)));
     DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  schema=%s",
                     DebugJString(jenv,schema)));
-    DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  mploc=%s",
-                    DebugJString(jenv,mploc)));
     DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  transactionIsolation=%ld",
                     transactionIsolation));
 
     const char *nCatalog;
     const char *nSchema;
-    const char *nMploc;
     jthrowable exception;
 
     jclass jcls = JNI_GetObjectClass(jenv,jobj);
@@ -852,8 +721,6 @@
     nCatalog = JNI_GetStringUTFChars(jenv,catalog, NULL);
     if (schema)
     nSchema = JNI_GetStringUTFChars(jenv,schema, NULL);
-    if (mploc)
-    nMploc = JNI_GetStringUTFChars(jenv,mploc, NULL);
 
     // Need to reset all if any CONTROL cmds were issued
     if (conReuseBitMap & org_apache_trafodion_jdbc_t2_SQLMXConnection_SQL_CONTROL_FLAG)
@@ -903,42 +770,6 @@
         }
         // new code end
 
-        if (srvrGlobal->nowaitOn == 2)
-        {
-            odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
-                    &setConnectException,
-                    dialogueId,
-                    SET_OLT_QUERY_OPT,
-                    0,
-                    NULL,
-                    &sqlWarning);
-            if (setConnectException.exception_nr != CEE_SUCCESS)
-            {
-                throwSetConnectionException(jenv, &setConnectException);
-                FUNCTION_RETURN_VOID(("SET_OLT_QUERY_OPT - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                                CliDebugSqlError(setConnectException.exception_nr)));
-            }
-        }
-
-        if (mploc)
-        {
-            odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
-                    &setConnectException,
-                    dialogueId,
-                    SET_MPLOC,
-                    0,
-                    (char *)nMploc,
-                    &sqlWarning);
-            JNI_ReleaseStringUTFChars(jenv,mploc, nMploc);
-
-            if (setConnectException.exception_nr != CEE_SUCCESS)
-            {
-                throwSetConnectionException(jenv, &setConnectException);
-                FUNCTION_RETURN_VOID(("SET_MPLOC - setConnectException.exception_nr(%s) is not CEE_SUCCESS",
-                                CliDebugSqlError(setConnectException.exception_nr)));
-            }
-        }
-
         if (catalog)
         {
             odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
@@ -1151,17 +982,6 @@
     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));
+#ifdef __cplusplus
 }
+#endif
diff --git a/core/conn/jdbc_type2/native/SQLMXDriver.cpp b/core/conn/jdbc_type2/native/SQLMXDriver.cpp
index 0f2a3e8..09d4949 100644
--- a/core/conn/jdbc_type2/native/SQLMXDriver.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXDriver.cpp
@@ -75,18 +75,13 @@
 * 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)
 {
-	FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitialize",("language=%s, nowaitOn=%ld",
-		DebugJString(jenv,language),
-		nowaitOn));
+	FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitialize",("language=%s,
+		DebugJString(jenv,language)));
 	const char 					*nLanguage;
 	//	static GlobalInformation	*globalInfo = new GlobalInformation();
-	//MFC
-	const char					*nModuleCaching;
-	const char					*nCompiledModuleLocation;
         
 	if (!driverVersionChecked)
 	{
@@ -109,128 +104,9 @@
 	if (! cacheJNIObjects(jenv))
 		FUNCTION_RETURN_VOID(("cacheJNIObjects() failed"));
 
-#ifdef NSK_PLATFORM		// Linux port
-	if (language)
-	{
-		nLanguage = JNI_GetStringUTFChars(jenv,language, NULL);
-		if (strcmp(nLanguage, "ja") == 0)
-		{
-			srvrGlobal->clientLCID = MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT);
-			srvrGlobal->clientErrorLCID = srvrGlobal->clientLCID;
-		}
-		else
-			if (strcmp(nLanguage, "en") == 0)
-			{
-				srvrGlobal->clientLCID = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), SORT_DEFAULT);
-				srvrGlobal->clientErrorLCID = srvrGlobal->clientLCID;
-			}
-			else
-			{
-				srvrGlobal->clientLCID = LANG_NEUTRAL;
-				srvrGlobal->clientErrorLCID = LANG_NEUTRAL;
-			}
-			JNI_ReleaseStringUTFChars(jenv,language, nLanguage);
-	}
-	else
-	{
-		srvrGlobal->clientLCID = LANG_NEUTRAL;
-		srvrGlobal->clientErrorLCID = LANG_NEUTRAL;
-	}
-#endif
-
 	srvrGlobal->dialogueId = 0;			// DialogueId is set to zero now
 
-	// Linux port - Nowait support is set to OFF for now.
-	// nowaitOn = 0;	// Should come command line or JDBC properties
-	
-	switch (nowaitOn)
-	{
-	case 0:
-		srvrGlobal->nowaitOn = 0;
-		break;
-	case 1:
-		srvrGlobal->nowaitOn = 1;
-		break;
-	case 2:
-		srvrGlobal->nowaitOn = 2;
-		break;
-	default:
-		srvrGlobal->nowaitOn = 0;
-		break;
-	}
-
-#ifdef NSK_PLATFORM		// Linux port
-	// setup MP system catalog name
-	if (envGetSystemCatalogName (&srvrGlobal->NskSystemCatalogName[0]) != TRUE)
-	{
-		throwSQLException(jenv, SYSTEM_CATALOG_ERROR, NULL, "HY000", 0);
-		FUNCTION_RETURN_VOID(("envGetSystemCatalogName() failed"));
-	}
-
-	// setup MX system catalog name
-	if (envGetMXSystemCatalogName (&srvrGlobal->SystemCatalog[0]) != TRUE)
-	{
-		throwSQLException(jenv, SYSTEM_CATALOG_ERROR, NULL, "HY000", 0);
-		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/SQLMXLobInputStream.cpp b/core/conn/jdbc_type2/native/SQLMXLobInputStream.cpp
new file mode 100644
index 0000000..5a71c07
--- /dev/null
+++ b/core/conn/jdbc_type2/native/SQLMXLobInputStream.cpp
@@ -0,0 +1,75 @@
+/**************************************************************************
+ // @@@ START COPYRIGHT @@@
+ //
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements.  See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership.  The ASF licenses this file
+ // to you under the Apache License, Version 2.0 (the
+ // "License"); you may not use this file except in compliance
+ // with the License.  You may obtain a copy of the License at
+ //
+ //   http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied.  See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ //
+ // @@@ END COPYRIGHT @@@
+ **************************************************************************/
+//
+// MODULE: SQLMXLobInputStream.cpp
+//
+#include <platform_ndcs.h>
+#include <sql.h>
+#include <sqlext.h>
+#include "JdbcDriverGlobal.h"
+#include "org_apache_trafodion_jdbc_t2_SQLMXLobInputStream.h"
+#include "SQLMXCommonFunctions.h"
+#include "CoreCommon.h"
+#include "SrvrCommon.h"
+#include "SrvrOthers.h"
+#include "CSrvrConnect.h"
+#include "Debug.h"
+#include "GlobalInformation.h"
+#include "sqlcli.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+JNIEXPORT jint JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXLobInputStream_readChunk
+  (JNIEnv *jenv, jobject jobj, jstring jServer, jlong jDialogueId, jlong txid, jint jExtractMode, jstring jLobLocator, jobject jByteBuffer)
+{
+   odbc_SQLsrvr_ExtractLob_exc_ exception = {0,0,0};
+   BYTE *chunkBuf = (BYTE *)jenv->GetDirectBufferAddress(jByteBuffer);
+   jlong jLength = jenv->GetDirectBufferCapacity(jByteBuffer);
+   const char *lobLocator = jenv->GetStringUTFChars(jLobLocator, NULL);
+   IDL_long_long  lobLength = 0; // Used when extractMode is 0 
+   IDL_long_long  extractLen = jLength;
+
+   odbc_SQLSrvr_ExtractLob_sme_(NULL, NULL, &exception, jDialogueId, jExtractMode, 
+                (IDL_char *)lobLocator, lobLength, extractLen, chunkBuf);
+   jenv->ReleaseStringUTFChars(jLobLocator, lobLocator);
+   switch (exception.exception_nr) {
+      case CEE_SUCCESS:
+         return extractLen;
+      case odbc_SQLSvc_ExtractLob_SQLError_exn_:
+         throwSQLException(jenv, &exception.u.SQLError);
+         break;
+      case odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_:
+         throwSQLException(jenv, MODULE_ERROR, exception.u.ParamError.ParamDesc, "HY000");
+         break;
+      case odbc_SQLSvc_ExtractLob_InvalidConnect_exn_:
+      default:
+         throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception.exception_nr);
+         break;
+   }
+   return -1;
+}
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/core/conn/jdbc_type2/native/SQLMXLobOutputStream.cpp b/core/conn/jdbc_type2/native/SQLMXLobOutputStream.cpp
new file mode 100644
index 0000000..145a470
--- /dev/null
+++ b/core/conn/jdbc_type2/native/SQLMXLobOutputStream.cpp
@@ -0,0 +1,68 @@
+/**************************************************************************
+ // @@@ START COPYRIGHT @@@
+ //
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements.  See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership.  The ASF licenses this file
+ // to you under the Apache License, Version 2.0 (the
+ // "License"); you may not use this file except in compliance
+ // with the License.  You may obtain a copy of the License at
+ //
+ //   http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied.  See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ //
+ // @@@ END COPYRIGHT @@@
+ **************************************************************************/
+//
+// MODULE: SQLMXLobInputStream.cpp
+//
+#include <platform_ndcs.h>
+#include <sql.h>
+#include <sqlext.h>
+#include "JdbcDriverGlobal.h"
+#include "org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream.h"
+#include "SQLMXCommonFunctions.h"
+#include "CoreCommon.h"
+#include "SrvrCommon.h"
+#include "SrvrOthers.h"
+#include "CSrvrConnect.h"
+#include "Debug.h"
+#include "GlobalInformation.h"
+#include "sqlcli.h"
+
+JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream_writeChunk
+  (JNIEnv *jenv, jobject jobj, jstring jServer, jlong jDialogueId, jlong jTxId, jstring jLobLocator, jbyteArray jChunk, 
+                         jint jOffset, jint jLength, jlong jPos)
+{
+   odbc_SQLSvc_UpdateLob_exc_ exception = {0,0,0};
+   BYTE *chunkBuf = new BYTE[jLength];
+   jenv->GetByteArrayRegion(jChunk, jOffset, jLength, (jbyte *)chunkBuf); 
+   const char *lobLocator = jenv->GetStringUTFChars(jLobLocator, NULL);
+
+   odbc_SQLSrvr_UpdateLob_sme_(NULL, NULL, &exception, jDialogueId, 
+                (IDL_char *)lobLocator, 0, jPos, jLength, chunkBuf);
+   delete chunkBuf;
+   jenv->ReleaseStringUTFChars(jLobLocator, lobLocator);
+   switch (exception.exception_nr) {
+      case CEE_SUCCESS:
+         break;
+      case odbc_SQLSvc_UpdateLob_SQLError_exn_:
+         throwSQLException(jenv, &exception.u.SQLError);
+         break;
+      case odbc_SQLSvc_UpdateLob_ParamError_exn_:
+      case odbc_SQLSvc_UpdateLob_SQLInvalidhandle_exn_:
+         throwSQLException(jenv, MODULE_ERROR, exception.u.ParamError.ParamDesc, "HY000");
+         break;
+      case odbc_SQLSvc_UpdateLob_InvalidConnect_exn_:
+      default:
+         throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception.exception_nr);
+         break;
+   }
+}
diff --git a/core/conn/jdbc_type2/native/SQLMXPreparedStatement.cpp b/core/conn/jdbc_type2/native/SQLMXPreparedStatement.cpp
index 568239e..0a33852 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);
@@ -257,36 +247,12 @@
 	jint errorRow = 0;
 	jint rowsExecuted = 0;
 	long totalRows;
-	short txn_status;
 
 	/* RFE: Batch update improvements
 	* If contBatchOnError is true, execution of batch commands continues even on errors
 	*/
-	// Try to resume or start the transaction
-	//10-091005-5100
-	if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1)) != 0)
-	{
-		DEBUG_OUT(DEBUG_LEVEL_ENTRY,("beginTxnControl() Failed"));
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwTransactionException(jenv, txn_status);
-		// Queue up the exception to be rethrown later
-		//queuedException = jenv->ExceptionOccurred();
-		if(exceptionHead)
-			jenv->CallVoidMethod(exceptionHead, gJNICache.setNextExceptionMethodId,
-			jenv->ExceptionOccurred());
-		else
-			exceptionHead = jenv->ExceptionOccurred();
-		jenv->ExceptionClear();
-		//break;
-		for(int nforX = 0; nforX < paramRowCount; ++nforX)
-		{
-			rowCount._buffer[nforX] = SQLMXStatement_EXECUTE_FAILED();
-			rowCount._length++;
-		}
-	}
-	//10-091005-5100
 	for (paramRowNumber = 0;
-		paramRowNumber < paramRowCount && txn_status == 0;
+		paramRowNumber < paramRowCount;
 		paramRowNumber += rowsExecuted)
 	{
 
@@ -470,29 +436,6 @@
 		}
 	}//end of for
 
-	/* RFE: Batch update improvements
-	* If contBatchOnError is true, CEE_SUCCESS is always passed instead of
-	* exception_.exception_nr, so that endTxnControl suspends the transaction.
-	*/
-	//10-091005-5100
-	if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit,
-		(exception_.exception_nr), isSelect, txnMode, externalTxid)) != 0)
-	{
-		DEBUG_OUT(DEBUG_LEVEL_ENTRY,("endTxnControl() Failed"));
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-		throwTransactionException(jenv, txn_status);
-		// Queue up the exception to be rethrown later
-		//queuedException = jenv->ExceptionOccurred();
-		if(exceptionHead)
-			jenv->CallVoidMethod(exceptionHead, gJNICache.setNextExceptionMethodId,
-			jenv->ExceptionOccurred());
-		else
-			exceptionHead = jenv->ExceptionOccurred();
-
-		jenv->ExceptionClear();
-		//break;
-	}
-
 	// Free up the cursor name
 	if (cursorName)
 		JNI_ReleaseStringUTFChars(jenv,cursorName, nCursorName);
@@ -530,246 +473,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/SQLMXResultSet.cpp b/core/conn/jdbc_type2/native/SQLMXResultSet.cpp
index 0b187da..6f37074 100644
--- a/core/conn/jdbc_type2/native/SQLMXResultSet.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXResultSet.cpp
@@ -74,7 +74,6 @@
 	
 	SRVR_STMT_HDL	*pSrvrStmt;
 	long			sqlcode;
-	short			txn_status;
 
 	if ((pSrvrStmt = getSrvrStmt(dialogueId, stmtId, &sqlcode)) == NULL)
 	{
@@ -82,25 +81,10 @@
 		FUNCTION_RETURN_NUMERIC(false,("getSrvrStmt() returned NULL"));
 	}
 
-	if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, holdability)) != 0)
-	{
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidRSMethodId, currentTxid);
-		throwTransactionException(jenv, txn_status);
-		FUNCTION_RETURN_NUMERIC(false,("beginTxnControl() failed"));
-	}
-
 	odbc_SQLSvc_FetchN_sme_(NULL, NULL, &exception_,
 			dialogueId, stmtId, maxRowCnt, FALSE, queryTimeout, &rowsAffected, &outputValueList,
 			&sqlWarning);
 
-	if ((txn_status = endTxnControl(jenv, currentTxid, 0, FALSE, 
-		(exception_.exception_nr == odbc_SQLSvc_FetchN_SQLNoDataFound_exn_ ? CEE_SUCCESS : 
-			exception_.exception_nr), TRUE, txnMode, externalTxid)) != 0)
-	{
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidRSMethodId, currentTxid);
-		throwTransactionException(jenv, txn_status);
-		FUNCTION_RETURN_NUMERIC(false,("endTxnControl() Failed"));
-	}
 	switch (exception_.exception_nr)
 	{
 	case CEE_SUCCESS:
@@ -165,19 +149,8 @@
 	ExceptionStruct				exception_;
 	long						rowsAffected;
 	ERROR_DESC_LIST_def			sqlWarning;
-	short						txn_status;
 	
 	ERROR_DESC_def				*error_desc_def;
-	// Don't bother resuming the transaction, if it is already zero. Try and close the cursor
-	if (currentTxid != 0)
-	{
-		if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, CLOSE_CURSORS_AT_COMMIT)) != 0 )
-		{
-			jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidRSMethodId, currentTxid);
-			throwTransactionException(jenv, txn_status);
-			FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
-		}
-	}
 	
 	odbc_SQLSvc_Close_sme_(NULL, NULL, &exception_,
 					dialogueId,
@@ -185,18 +158,6 @@
 					(dropStmt ? SQL_DROP : SQL_CLOSE),
 					&rowsAffected,
 					&sqlWarning);
-	
-	if (currentTxid != 0)
-	{
-		if ((txn_status = endTxnControl(jenv, currentTxid, 0, autoCommit, 0, selectStmt, txnMode, externalTxid)) != 0)
-		{
-			jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidRSMethodId, currentTxid);
-			throwTransactionException(jenv, txn_status);
-			FUNCTION_RETURN_VOID(("endTxnControl() failed"));
-		}
-		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidRSMethodId, currentTxid);
-	}	
-	
 	switch (exception_.exception_nr)
 	{
 	case CEE_SUCCESS:
diff --git a/core/conn/jdbc_type2/native/SQLMXStatement.cpp b/core/conn/jdbc_type2/native/SQLMXStatement.cpp
index a10c240..7fb2b41 100644
--- a/core/conn/jdbc_type2/native/SQLMXStatement.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXStatement.cpp
@@ -72,7 +72,6 @@
 	jboolean		isCopy;
 	jsize			len;
 	SQLValue_def	sqlString;
-	short			txn_status;
 
 	sqlString.dataCharset = 0;
 	sqlString.dataInd = 0;
@@ -116,13 +115,6 @@
 	else
 		nCursorName = 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"));
-	}
-
 	exception_.u.SQLError.errorList._buffer = NULL;
 	odbc_SQLSvc_ExecDirect_sme_(NULL, NULL, 
 			&exception_,
@@ -150,14 +142,6 @@
 	if (cursorName)
 		JNI_ReleaseStringUTFChars(jenv,cursorName, nCursorName);
 
-	if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, 
-						exception_.exception_nr, isSelect, 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:
@@ -224,7 +208,6 @@
 	const char					*nStmtLabel;
 	const char					*nRSStmtLabel;
 	jboolean					isCopy;
-	short						txn_status;
 
 	if (stmtLabel)
 		nStmtLabel = JNI_GetStringUTFChars(jenv,stmtLabel, NULL);
@@ -241,41 +224,26 @@
 		FUNCTION_RETURN_VOID(("RSstmtLabel 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"));
-	}
+	jdbc_SQLSvc_ExecSPJRS_sme_(NULL, NULL, 	
+			&exception_,	
+			dialogueId,	
+			nStmtLabel,	
+			nRSStmtLabel,	
+			EXTERNAL_STMT,	
+			(isSelect ? TYPE_SELECT : TYPE_UNKNOWN),	
+			(long) resultSet,	
+			ResultSetIndex,	
+			&outputDesc,	
+			&sqlWarning,	
+			&RSstmtId,	
+			stmtId);	
 
-	jdbc_SQLSvc_ExecSPJRS_sme_(NULL, NULL, 
-			&exception_,
-			dialogueId,
-			nStmtLabel,
-			nRSStmtLabel,
-			EXTERNAL_STMT,
-			(isSelect ? TYPE_SELECT : TYPE_UNKNOWN),
-			(long) resultSet,
-			ResultSetIndex,
-			&outputDesc,
-			&sqlWarning,
-			&RSstmtId,
-			stmtId);
+	if (stmtLabel)	
+		JNI_ReleaseStringUTFChars(jenv, stmtLabel, nStmtLabel);	
 
-	if (stmtLabel)
-		JNI_ReleaseStringUTFChars(jenv, stmtLabel, nStmtLabel);
-
-	if (RSstmtLabel)
+	if (RSstmtLabel)	
 		JNI_ReleaseStringUTFChars(jenv, RSstmtLabel, nRSStmtLabel);
 
-	if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, 
-						exception_.exception_nr, isSelect, 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:
@@ -395,11 +363,9 @@
 	long			stmtId;
 	jsize			len;
 	SQLValue_def	sqlString;
-	short			txn_status;	
 	// RFE: Batch update improvements
 	jthrowable		queuedException = NULL;
 	jthrowable		exceptionHead = NULL;
-	bool			isSuspended = false;
 
 	exception_.exception_nr = CEE_SUCCESS;
 
@@ -413,13 +379,6 @@
 
 	if (cursorName) nCursorName = JNI_GetStringUTFChars(jenv,cursorName, 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"));
-	}
-
 	sqlString.dataCharset = 0;
 	sqlString.dataInd = 0;
 	sqlString.dataType = SQLTYPECODE_VARCHAR;
@@ -428,20 +387,6 @@
 
 	for (i = 0; i < noOfCommands ; i++)
 	{
-		/* RFE: Batch update improvements
-		 * Resume the transaction if it was earlier suspended, by checking the
-		 * variable isSuspended. This is reset to false after the transaction is resumed.
-		 */
-		if(isSuspended)
-		{
-			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"));
-			}
-			isSuspended = false;
-		}
 		sql = (jstring) JNI_GetObjectArrayElement(jenv,sqlCommands, i);
 		if (sql)
 		{
@@ -501,20 +446,6 @@
 				if (cursorName)
 					JNI_ReleaseStringUTFChars(jenv,cursorName, nCursorName);
 			}
-
-			// Commit the transaction so all good statements are processed.			
-			txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, 
-									   CEE_SUCCESS, isSelect, txnMode, externalTxid);						
-			jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-			if (txn_status != 0)
-			{
-				throwTransactionException(jenv, txn_status);
-				DEBUG_OUT(DEBUG_LEVEL_ENTRY|DEBUG_LEVEL_TXN,("endTxnControl() Failed after ExecDirect failure"));
-			}
-			//RFE: Batch update improvements
-			if(contBatchOnError)
-				isSuspended = true;
-
 		}
 
 		switch (exception_.exception_nr)
@@ -580,16 +511,7 @@
 
 	/* RFE: Batch update improvements
 	 * If contBatchOnError is true, CEE_SUCCESS is always passed instead of
-	 * exception_.exception_nr, so that endTxnControl suspends the transaction.	 
 	 */	
-	txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, 
-							   (contBatchOnError ? CEE_SUCCESS:exception_.exception_nr), isSelect, txnMode, externalTxid);
-	jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
-	if (txn_status != 0)
-	{
-		throwTransactionException(jenv, txn_status);
-		FUNCTION_RETURN_VOID(("endTxnControl() failed"));
-	}
 	/* RFE: Batch update improvements
 	 * Throw the queued exception if any */
 	if(exceptionHead)
diff --git a/core/conn/jdbc_type2/native/SqlInterface.cpp b/core/conn/jdbc_type2/native/SqlInterface.cpp
index 1076fb3..861cdec 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
 
@@ -330,6 +328,16 @@
 			&allocSize,
 			NULL);
 		break;
+	case SQLTYPECODE_CLOB:
+		SQLItemDesc->ODBCDataType  = TYPE_CLOB;
+		SQLItemDesc->signType      = FALSE;
+		SQLItemDesc->ODBCPrecision = 0;
+	        break;	
+	case SQLTYPECODE_BLOB:
+		SQLItemDesc->ODBCDataType  = TYPE_BLOB;
+		SQLItemDesc->signType      = FALSE;
+		SQLItemDesc->ODBCPrecision = 0;
+		break;
 	case SQLTYPECODE_BIT:
 	case SQLTYPECODE_BITVAR:
 	case SQLTYPECODE_IEEE_FLOAT:
@@ -1147,70 +1155,8 @@
 		} // End of stmt type switch
 	} // End of VER20 check
 
-#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)
-		{
-			SQLRETURN 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:		// Wait Success
-				// If not closed, try closing and clear out diag's
-				if(!pSrvrStmt->isClosed)
-				{
-					retcode = CLI_CloseStmt(pStmt);
-					pSrvrStmt->isClosed = TRUE;
-					if (retcode != 0) CLI_ClearDiagnostics(pStmt);
-				}
-				retcode = 0;
-				break;
-			case 9999:	// Wait error
-				pSrvrStmt->isClosed = TRUE;
-				THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-			default:	// All other errors
-				pSrvrStmt->isClosed = TRUE;
-				retcode = GETSQLCODE(pSrvrStmt);
-				break;
-			}
-			DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s",
-				pSrvrStmt->nowaitRetcode,
-				CliDebugSqlError(retcode)));
-		}
-		else
-		{
-			// If waitForCompletion() was not successful (rtn != 0)
-			pSrvrStmt->isClosed = TRUE;
-			pSrvrStmt->nowaitRetcode = rtn;
-			THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-		}
-	}
-	else
-#endif	
-	{
-		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
-			}
-		}
-	}
-
+	if (retcode != SQL_SUCCESS) 
+		pSrvrStmt->isClosed = TRUE;
 	// Process the SQL CLI return code
 	if (retcode != 0){						// SQL success
 		if (retcode == 100) {				// No Data Found
@@ -1407,22 +1353,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);
@@ -1493,39 +1423,6 @@
 
 	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);
 
 	pSrvrStmt->estimatedCost = -1;
@@ -1681,59 +1578,6 @@
 		retcode = CLI_Fetch(&pSrvrStmt->stmt, pDesc, 0);
 
 		int rtn;
-
-#ifndef DISABLE_NOWAIT		
-		if (retcode == NOWAIT_PENDING){
-			rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex);
-			DEBUG_OUT(DEBUG_LEVEL_ENTRY,("WaitForCompletion() returned %d",rtn));
-
-			if (rtn == 0){
-				SQLRETURN 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:			// nowaitRetcode is successful
-					retcode = 0;
-					break;
-				case 9999:
-					THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-				default:
-					/* Soln No: 10-070223-2784
-					Desc: JDBC/MX should call stmtinfo2 instead of Diagoninfo2 CLI call for rowsets
-					*/
-					/*     long row = 0;
-					retcode = CLI_GetDiagnosticsStmtInfo2(&pSrvrStmt->stmt,SQLDIAG_ROW_COUNT,&row,NULL,0,NULL);
-					if(row == 0)
-					retcode = GETSQLCODE(pSrvrStmt);
-					*/
-					// Refixed 10-070223-2784 for sol.10-090613-2299
-					retcode = GETSQLCODE(pSrvrStmt);
-
-					long rows_read_fin = 0;
-					long retcodenew = 0;
-					if (pSrvrStmt->fetchRowsetSize > 0)
-					{
-						retcodenew = ReadRow(pSrvrStmt, &curRowCount, &rows_read_fin);
-						if (retcodenew < 0) THREAD_RETURN(pSrvrStmt,retcodenew);
-						if (retcodenew > 0) sqlWarning = TRUE;
-
-						curRowNo += rows_read_fin;
-					}
-					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
-
 		if (retcode != 0)
 		{                  //Check for a bad return code
 			if (retcode == 100)
@@ -2108,47 +1952,6 @@
 	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
 	pSrvrStmt->isClosed = FALSE;
 
-#ifndef DISABLE_NOWAIT		
-	if (retcode == NOWAIT_PENDING){
-		rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex);
-		DEBUG_OUT(DEBUG_LEVEL_CLI,("EXECUTESPJRS : WaitForCompletion() returned %d",rtn));
-
-		if (rtn == 0)
-		{
-			rc = pSrvrStmt->switchContext();
-			DEBUG_OUT(DEBUG_LEVEL_CLI,("EXECUTESPJRS  pSrvrStmt->switchContext() return with: %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:
-				pSrvrStmt->isClosed = TRUE;
-				THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-			default:
-				pSrvrStmt->isClosed = TRUE;
-				retcode = GETSQLCODE(pSrvrStmt);
-				break;
-			}
-			DEBUG_OUT(DEBUG_LEVEL_CLI,
-				("EXECUTESPJRS : pSrvrStmt->nowaitRetcode=%ld, retcode=%s",
-				pSrvrStmt->nowaitRetcode,
-				CliDebugSqlError(retcode)));
-		}
-		else
-		{
-			pSrvrStmt->isClosed = TRUE;
-			pSrvrStmt->nowaitRetcode = rtn;
-			THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-		}
-	}
-#endif
-
-	// Note this could do a return
-	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
 	if (sqlWarning) THREAD_RETURN(pSrvrStmt,SQL_SUCCESS_WITH_INFO);
 	THREAD_RETURN(pSrvrStmt,SQL_SUCCESS);
 }
@@ -2193,137 +1996,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",
@@ -2355,21 +2027,7 @@
 		pStmt->identifier_len = 0;
 		pStmt->identifier = NULL;
 	}
-
-	if (srvrGlobal->nowaitOn)
-	{
-#if defined(TAG64)
-		tempStmtId=(int _ptr32*)malloc32(sizeof(int));
-		pStmt->tag=(int)tempStmtId;
-		tempStmtIdMap[(long)tempStmtId]=pSrvrStmt;
-#else
-		pStmt->tag = (long)pSrvrStmt;
-#endif
-	}
-	else
-	{
-		pStmt->tag = 0;
-	}
+	pStmt->tag = 0;
 	if (pModule->module_name == NULL)
 	{
 		retcode = CLI_AllocStmt(pStmt,(SQLSTMT_ID *)NULL);
@@ -2381,9 +2039,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;
@@ -2460,19 +2116,8 @@
 		pSrvrStmt->outputDescName[pOutputDesc->identifier_len] = '\0';
 	}
 
-	if (srvrGlobal->nowaitOn)
-	{
-		retcode = CLI_AssocFileNumber(pStmt, srvrGlobal->nowaitFilenum);
-		if (retcode < 0)
-		{
-			CLI_ClearDiagnostics(NULL);
-			CLI_DEBUG_RETURN_SQL(retcode);
-		}
-	}
-
 	// 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 
@@ -2556,19 +2201,7 @@
 	DEBUG_OUT(DEBUG_LEVEL_STMT,("***pStmt->identifier_len=%ld", pStmt->identifier_len));
 	DEBUG_OUT(DEBUG_LEVEL_STMT,("***pStmt->identifier=%s", pStmt->identifier));
 
-	if (srvrGlobal->nowaitOn)
-	{
-#if defined(TAG64)
-		tempStmtId=(int _ptr32*)malloc32(sizeof(int));
-		pStmt->tag=(int)tempStmtId;
-		tempStmtIdMap[(int)tempStmtId]=pSrvrStmt;
-
-#else
-		pStmt->tag = (long)pSrvrStmt;
-#endif
-	}
-	else
-		pStmt->tag = 0;
+	pStmt->tag = 0;
 	if (pModule->module_name == NULL)
 	{
 		DEBUG_OUT(DEBUG_LEVEL_STMT,("***pModule->module_name == NULL  Call AllocStmtForRs()"));
@@ -2624,16 +2257,6 @@
 		}
 	}
 
-	if (srvrGlobal->nowaitOn)
-	{
-		retcode = CLI_AssocFileNumber(pStmt, srvrGlobal->nowaitFilenum);
-		if (retcode < 0)
-		{
-			CLI_ClearDiagnostics(NULL);
-			CLI_DEBUG_RETURN_SQL(retcode);
-		}
-	}
-
 	// Set the output Desc to be Wide Descriptors
 	if (pSrvrStmt->useDefaultDesc)
 	{
@@ -2705,57 +2328,11 @@
 	}
 
 	DEBUG_ASSERT(pSrvrStmt->isClosed, ("Server Statement is Open before int."));
-	pSrvrStmt->isClosed = FALSE;
-
 	retcode = CLI_Exec(pStmt, pDescValue, 0);
 	DEBUG_OUT(DEBUG_LEVEL_STMT,("intCALL  CLI_EXEC  retcode: %ld.", retcode));
 	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
 	pSrvrStmt->isClosed = FALSE;
 
-#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() return with: %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:
-				pSrvrStmt->isClosed = TRUE;
-				THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-			default:
-				pSrvrStmt->isClosed = TRUE;
-				retcode = GETSQLCODE(pSrvrStmt);
-				break;
-			}
-			DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s",
-				pSrvrStmt->nowaitRetcode,
-				CliDebugSqlError(retcode)));
-		}
-		else
-		{
-			pSrvrStmt->isClosed = TRUE;
-			pSrvrStmt->nowaitRetcode = rtn;
-			THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-		}
-	}
-	else
-#endif
-	{
-		if (retcode!=SQL_SUCCESS) pSrvrStmt->isClosed = TRUE;
-	}
-
-	// Note this could do a return
-	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
-
 	pDesc       = &pSrvrStmt->outputDesc;
 	columnCount = pSrvrStmt->columnCount;
 
@@ -2770,47 +2347,6 @@
 
 	retcode = CLI_Fetch(pStmt, pDescParam, 0);
 
-#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() return with: %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:
-				pSrvrStmt->isClosed = TRUE;
-				THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-			default:
-				pSrvrStmt->isClosed = TRUE;
-				retcode = GETSQLCODE(pSrvrStmt);
-				break;
-			}
-			DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s",
-				pSrvrStmt->nowaitRetcode,
-				CliDebugSqlError(retcode)));
-		}
-		else
-		{
-			pSrvrStmt->isClosed = TRUE;
-			pSrvrStmt->nowaitRetcode = rtn;
-			THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR);
-		}
-	}
-	else
-#endif	
-	{
-		if (retcode!=SQL_SUCCESS) pSrvrStmt->isClosed = TRUE;
-	}
-
 	// Return if the fetch failed
 	HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt);
 
@@ -2912,1535 +2448,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;
-	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 148b06e..36b296a 100644
--- a/core/conn/jdbc_type2/native/SrvrCommon.cpp
+++ b/core/conn/jdbc_type2/native/SrvrCommon.cpp
@@ -231,34 +231,6 @@
     short   error;
     int     retcode = 0;
 
-#ifndef DISABLE_NOWAIT
-    if (srvrGlobal->nowaitOn)
-    {
-        error = FILE_OPEN_(SQL_PSEUDO_FILE,         // Filename
-            strlen(SQL_PSEUDO_FILE),    // The length of file name Guardian does not understand C strings
-            &srvrGlobal->nowaitFilenum, // Return the file number (file descriptor)
-            ,                          // Access - soecifies the desired access mode (default read-write)
-            ,                          // Exclusion - specifies the desired mode (default shared)
-            1);                      // Nowait-depth - number of outstanding I/O requests
-        retcode = error;
-        if (error != FEOK)
-        {
-            // TODO - Write to EMS log in future
-            srvrGlobal->nowaitOn = FALSE;
-        }
-    }
-    if (srvrGlobal->nowaitOn)
-    {
-        retcode = registerPseudoFileIO(srvrGlobal->nowaitFilenum);
-        if (retcode != TSLXE_SUCCESS)
-        {
-            // TODO - Write to EMS log in future
-            srvrGlobal->nowaitOn = FALSE;
-        }
-
-    }
-#endif
-
     gDescItems[0].item_id = SQLDESC_TYPE;
     gDescItems[1].item_id = SQLDESC_OCTET_LENGTH;
     gDescItems[2].item_id = SQLDESC_PRECISION;
@@ -485,58 +457,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 +1019,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 +1628,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_;
@@ -1812,6 +1732,8 @@
     {
     case SQLTYPECODE_CHAR:
     case SQLTYPECODE_VARCHAR:
+    case SQLTYPECODE_CLOB:
+    case SQLTYPECODE_BLOB:
         if( nullRequired(char_set) )
             varNulls = 1;
         break;
@@ -2012,251 +1934,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 08d8a7c..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
     }
 
@@ -291,14 +282,14 @@
         exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_INVALID_ROW_COUNT;
         FUNCTION_RETURN_VOID(("totalRowCount <= 0"));
     }
-
+/*
     if ((sqlStmtType & TYPE_SELECT) && totalRowCount > 1)
     {
         exception_->exception_nr = odbc_SQLSvc_ExecuteN_ParamError_exn_;
         exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_INVALID_ROW_COUNT_AND_SELECT;
         FUNCTION_RETURN_VOID(("sqlStmtType is TYPE_SELECT && totalRowCount > 1"));
     }
-
+*/
 
     /// For Modius.
     rc = pSrvrStmt->switchContext();
@@ -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
@@ -1529,3 +1403,127 @@
     }
     FUNCTION_RETURN_VOID((NULL));
 }
+
+extern "C" void
+odbc_SQLSrvr_ExtractLob_sme_(
+    /* In    */ void *objtag_
+  , /* In    */ const CEE_handle_def *call_id_
+  , /* Out   */ odbc_SQLsrvr_ExtractLob_exc_ *exception_
+  , /* In    */ long dialogueId
+  , /* In    */ IDL_short extractLobAPI
+  , /* In    */ IDL_string lobHandle
+  , /* In    */ IDL_long_long &lobLength
+  , /* Out   */ IDL_long_long &extractLen
+  , /* Out   */ BYTE *& extractData
+  )
+{
+    char lobExtractQuery[1000] = {0};
+    long sqlcode;
+    SRVR_STMT_HDL  *QryLobExtractSrvrStmt = NULL;
+
+    if ((QryLobExtractSrvrStmt = createSrvrStmt(dialogueId, "MXOSRVR_EXTRACTLOB", &sqlcode, 
+			NULL, 0, 0, TYPE_UNKNOWN, false,false)) == NULL) 
+    {
+       exception_->exception_nr = odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_;
+       return;
+    }
+    switch (extractLobAPI) {
+    case 0:
+        snprintf(lobExtractQuery, sizeof(lobExtractQuery), "EXTRACT LOBLENGTH(LOB'%s') LOCATION %llu", lobHandle, (Int64)&lobLength);
+        break;
+    case 1:
+        snprintf(lobExtractQuery, sizeof(lobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %llu, SIZE %llu)", lobHandle, extractData, &extractLen);
+        break;
+    case 2:
+        extractLen = 0;
+        snprintf(lobExtractQuery, sizeof(lobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %llu, SIZE %llu)", lobHandle, 0L, &extractLen);
+        break;
+    default:
+        return ;
+    }
+    SQLValue_def sqlStringValue;
+    sqlStringValue.dataValue._buffer = (unsigned char *)lobExtractQuery;
+    sqlStringValue.dataValue._length = strlen(lobExtractQuery);
+    sqlStringValue.dataCharset = 0;
+    sqlStringValue.dataType = SQLTYPECODE_VARCHAR;
+    sqlStringValue.dataInd = 0;
+
+    try
+    {
+        short retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, &sqlStringValue, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0);
+        if (retcode == SQL_ERROR)
+        {
+            ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
+            exception_->exception_nr = odbc_SQLSvc_ExtractLob_SQLError_exn_;
+            exception_->u.SQLError.errorList._length = QryLobExtractSrvrStmt->sqlError.errorList._length;
+            exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
+        }
+    }
+    catch (...)
+    {
+        exception_->exception_nr = odbc_SQLSvc_ExtractLob_ParamError_exn_;
+        exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECDIRECT_FAILED;
+    }
+    if (QryLobExtractSrvrStmt != NULL) 
+        QryLobExtractSrvrStmt->Close(SQL_DROP);
+
+}
+
+extern "C" void
+odbc_SQLSrvr_UpdateLob_sme_(
+    /* In   */ void *objtag_
+  , /* In   */ const CEE_handle_def * call_id_
+  , /* In   */ odbc_SQLSvc_UpdateLob_exc_ * exception_
+  , /* In   */ long dialogueId
+  , /* In   */ IDL_string lobHandle
+  , /* In   */ IDL_long_long totalLength
+  , /* In   */ IDL_long_long offset
+  , /* In   */ IDL_long_long length
+  , /* In   */ BYTE * data)
+{
+    char lobUpdateQuery[1000] = {0};
+    long sqlcode;
+
+    SRVR_STMT_HDL * QryLobUpdateSrvrStmt = NULL;
+
+    if ((QryLobUpdateSrvrStmt = createSrvrStmt(dialogueId, "MXOSRVR_UPDATELOB", &sqlcode, 
+			NULL, 0, 0, TYPE_UNKNOWN, false,false)) == NULL) {
+        exception_->exception_nr = odbc_SQLSvc_UpdateLob_SQLInvalidhandle_exn_;
+	return;
+    }
+
+    if (offset == 0) {
+        snprintf(lobUpdateQuery, sizeof(lobUpdateQuery),  "UPDATE LOB (LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)data, length);
+    } else {
+        snprintf(lobUpdateQuery, sizeof(lobUpdateQuery),  "UPDATE LOB (LOB'%s', LOCATION %Ld, SIZE %Ld, APPEND)", lobHandle, (Int64)data, length);
+    }
+
+    SQLValue_def sqlStringValue;
+    sqlStringValue.dataValue._buffer = (unsigned char *)lobUpdateQuery;
+    sqlStringValue.dataValue._length = strlen(lobUpdateQuery);
+    sqlStringValue.dataCharset = 0;
+    sqlStringValue.dataType = SQLTYPECODE_VARCHAR;
+    sqlStringValue.dataInd = 0;
+                                
+    short retcode = 0;
+    try {
+       retcode = QryLobUpdateSrvrStmt->ExecDirect(NULL, &sqlStringValue, EXTERNAL_STMT, TYPE_UNKNOWN, SQL_ASYNC_ENABLE_OFF, 0);
+
+       if (retcode == SQL_ERROR) {
+           exception_->exception_nr = odbc_SQLSvc_UpdateLob_SQLError_exn_;
+           exception_->u.SQLError.errorList._length = QryLobUpdateSrvrStmt->sqlError.errorList._length;
+           exception_->u.SQLError.errorList._buffer = QryLobUpdateSrvrStmt->sqlError.errorList._buffer;
+       }
+    }
+    catch (...)
+    {
+        exception_->exception_nr = odbc_SQLSvc_UpdateLob_ParamError_exn_;
+        exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED;
+    }
+
+    if (QryLobUpdateSrvrStmt != NULL) {
+        QryLobUpdateSrvrStmt->Close(SQL_DROP);
+    }
+    return;
+}
+
diff --git a/core/conn/jdbc_type2/native/SrvrOthers.h b/core/conn/jdbc_type2/native/SrvrOthers.h
index 26cb37c..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
@@ -380,7 +343,84 @@
 								, /* In    */ const char *fktableNm
 								);
 
+/***************************************
+ *  * Operation 'odbc_SQLsrvr_ExtractLob'
+ *   * *************************************/
+/*
+ *  * Exception number constants for
+ *   * operation 'odbc_SQLsrvr_ExtractLob'
+ *    */
+
+#define odbc_SQLSvc_ExtractLob_ParamError_exn_        1
+#define odbc_SQLSvc_ExtractLob_InvalidConnect_exn_ 2
+#define odbc_SQLSvc_ExtractLob_SQLError_exn_ 3
+#define odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_ 4
+#define obdc_SQLSvc_ExtractLob_AllocLOBDataError_exn_ 5
+
+/*
+ *  * Exception struct for
+ *   * Operation "odbc_SQLSrvr_ExtractLob"
+ *    */
+struct odbc_SQLsrvr_ExtractLob_exc_ {
+    IDL_long exception_nr;
+    IDL_long exception_detail;
+    union {
+        odbc_SQLSvc_ParamError ParamError;
+        odbc_SQLSvc_SQLError SQLError;
+    } u;
+};
+
+/***************************************
+ *  * Operation 'odbc_SQLsvc_UpdateLob'
+ *   ***************************************/
+/*
+ *  * Exceptoin number constants for
+ *   * operation 'odbc_SQLSvc_UpdateLob'
+ *                                           
+ *                                            */
+#define odbc_SQLSvc_UpdateLob_ParamError_exn_        1
+#define odbc_SQLSvc_UpdateLob_InvalidConnect_exn_    2
+#define odbc_SQLSvc_UpdateLob_SQLError_exn_          3
+#define odbc_SQLSvc_UpdateLob_SQLInvalidhandle_exn_  4
+
+/*
+ *  * Exception struct for
+ *   * Operation "odbc_SQLSvc_UpdateLob"
+ *    */
+struct odbc_SQLSvc_UpdateLob_exc_ {
+  IDL_long exception_nr;
+  IDL_long exception_detail;
+  union {
+    odbc_SQLSvc_ParamError ParamError;
+    odbc_SQLSvc_SQLError   SQLError;
+  } u;
+};
+
+extern "C" void
+odbc_SQLSrvr_ExtractLob_sme_(
+    /* In    */ void *objtag_
+  , /* In    */ const CEE_handle_def *call_id_
+  , /* In    */ odbc_SQLsrvr_ExtractLob_exc_ *exception_
+  , /* In    */ long dialogueId
+  , /* In    */ IDL_short extractLobAPI
+  , /* In    */ IDL_string lobHandle
+  , /* In    */ IDL_long_long &lobLength
+  , /* Out   */ IDL_long_long &extractLen
+  , /* Out   */ BYTE *& extractData);
+
+extern "C" void
+odbc_SQLSrvr_UpdateLob_sme_(
+    /* In   */ void *objtag_
+  , /* In   */ const CEE_handle_def * call_id_
+  , /* In   */ odbc_SQLSvc_UpdateLob_exc_  *exception_
+  , /* In    */ long dialogueId
+  , /* In   */ IDL_string lobHandle
+  , /* In   */ IDL_long_long totalLength
+  , /* In   */ IDL_long_long offset
+  , /* In   */ IDL_long_long length
+  , /* In   */ BYTE * data);
+
+
 //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/native/pThreadsSync.h b/core/conn/jdbc_type2/native/pThreadsSync.h
index 9e4ec20..a6a8a44 100644
--- a/core/conn/jdbc_type2/native/pThreadsSync.h
+++ b/core/conn/jdbc_type2/native/pThreadsSync.h
@@ -34,15 +34,6 @@
 
 #include <csrvrstmt.h>
 
-
-extern int registerPseudoFileIO(short fileNum);
-
-extern int initStmtForNowait(_TSLX_cond_t *cond, _TSLX_mutex_t *mutex);
-
-extern int WaitForCompletion(SRVR_STMT_HDL *pSrvrStmt, _TSLX_cond_t *cond, _TSLX_mutex_t *mutex);
-
-
-
 extern int mutexCondDestroy(_TSLX_cond_t *cond, _TSLX_mutex_t *mutex);
 
 extern short abortTransaction (void);
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/DataWrapper.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/DataWrapper.java
index f0609ec..46bf051 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/DataWrapper.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/DataWrapper.java
@@ -2120,6 +2120,7 @@
 				else
 				{
 					obj = getObject(col_idx+1);
+/* TODO: Selva
 					if (obj instanceof SQLMXLob)
 					{
 						if (orig_obj==this)
@@ -2129,6 +2130,7 @@
 							continue;
 						}
 					}
+*/
 					updateStmt.setObject(++param_idx, obj);
 				}
 			}
@@ -2197,7 +2199,7 @@
 		}
 	}
 
-	void closeLobObjects()
+	void closeLobObjects() throws SQLException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_closeLobObjects].methodEntry();
 		try
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/SQLMXBlob.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXBlob.java
index 3bbdf4a..13212b7 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXBlob.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXBlob.java
@@ -32,8 +32,11 @@
 import java.io.Reader;
 import java.io.OutputStream;
 import java.io.Writer;
+import java.io.IOException;
 import java.util.Date;
 import java.io.PrintWriter;
+import java.io.ByteArrayInputStream;
+import java.util.Arrays;
 
 public class SQLMXBlob extends SQLMXLob implements Blob 
 {
@@ -54,156 +57,31 @@
 
 	public byte[] getBytes(long pos, int length) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getBytes].methodEntry();
-		try
-		{
-			int startChunkNo;
-			int endChunkNo;
-			int offset;
-			int copyLen;
-			int copyOffset;
-			int dataLength;
-			int readLen;
-			long blobDataLen;
-			byte[] data;
-			byte[] b;
-			byte[] b1;
-
-			if (pos <= 0 || length < 0 )
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "Blob.getBytes(long, int): position is less than or equal to 0, or length is less than 0";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-
-			// Blob data total length must be larger than pos supplied (used to offset the bytes)
-			blobDataLen = length();
-			if (pos > blobDataLen) 
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "Blob.getBytes(long, int): position (" + pos + ") exceeds the Blob data length (" + blobDataLen + ")";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-
-			checkIfCurrent();
-			startChunkNo = (int)((pos-1) / chunkSize_);
-			endChunkNo = (int)((pos-1+length)/ chunkSize_);
-			copyLen = length;
-			offset = (int)((pos-1) % chunkSize_);
-			copyOffset= 0;
-			readLen = 0;
-			b = new byte[length];
-			prepareGetLobDataStmt();
-
-			if ((traceWriter_ != null) && 
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId() 
-					+ "getBytes(" + pos + "," + length + ") - GetLobDataStmt params: tableName_=" + tableName_ 
-					+ " dataLocator_=" + dataLocator_
-					+ " startChunkNo=" + startChunkNo
-					+ " endChunkNo=" + endChunkNo);
-			}
-
-			synchronized (conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT])
-			{
-				conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setString(1, tableName_);
-				conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setLong(2, dataLocator_);
-				conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setInt(3, startChunkNo);
-				conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setInt(4, endChunkNo);
-				ResultSet rs = conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].executeQuery();
-				try
-				{
-					while (rs.next())
-					{
-						data = rs.getBytes(1);
-						dataLength = data.length-offset;
-						
-						if (dataLength >= copyLen)
-						{
-							System.arraycopy(data, offset, b, copyOffset, copyLen);
-							readLen += copyLen;
-							break;
-						} 
-						else
-						{
-							System.arraycopy(data, offset, b, copyOffset, dataLength);
-							copyLen -= dataLength;
-							copyOffset += dataLength;
-							readLen += dataLength;
-						}
-						offset = 0;	// reset the offset 
-					}
-				}
-				finally
-				{
-					rs.close();
-				}
-			}
-			if (readLen == length)
-				return b;
-			else
-			{
-				b1 = new byte[readLen];
-				System.arraycopy(b, 0, b1, 0, readLen);
-				return b1;
-			}
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getBytes].methodExit();
+	 	long skippedLen;	
+		checkIfCurrent();
+		InputStream is = getInputStream();
+		try {
+	        	skippedLen = is.skip(pos);	
+			if (skippedLen < pos)
+				return new byte[0];
+			byte[] buf = new byte[length];
+			int retLen = is.read(buf, 0, length);
+			if (retLen < length)
+				buf = Arrays.copyOf(buf, retLen);
+			return buf;
+		} catch (IOException ioe) {
+			throw new SQLException(ioe);
 		}
 	}
 
 	public long position(Blob pattern, long start) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_position_LJ].methodEntry();
-		try
-		{
-			byte[] searchPattern;
-		
-			if (start <= 0 )
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "Blob.position(Blob, long)";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-			checkIfCurrent();
-			searchPattern = pattern.getBytes(1L,(int)pattern.length());
-			return position(searchPattern, start);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_position_LJ].methodExit();
-		}
+		throw new SQLFeatureNotSupportedException("Blob.position(Blob, long) not supported");
 	}
 
 	public long position(byte[] pattern, long start) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_position_BJ].methodEntry();
-		try
-		{
-			byte[] blobData;
-			long retValue;
-
-			if (start <= 0 )
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "Blob.position(byte[], long)";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-			checkIfCurrent();
-			blobData = getBytes(start, (int)length());
-			retValue = findBytes(blobData, 0, blobData.length, pattern);
-			if (retValue != -1)
-				retValue += start;
-
-			return retValue;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_position_BJ].methodExit();
-		}
+		throw new SQLFeatureNotSupportedException("Blob.position(String, long) not supported");
 	}
 
 
@@ -212,9 +90,14 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_setBinaryStream].methodEntry();
 		try
 		{
+			if (pos < 0) {
+				Object[] messageArguments = new Object[1];
+				messageArguments[0] = "Blob.setBinaryStream(long)";
+				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
+			}
+			if (pos > 1)
+				throw new SQLFeatureNotSupportedException("Blob.setBinaryStream with position > 1 is not supported");
 			// Check if Autocommit is set, and no external transaction exists
-			checkAutoCommitExtTxn();
-			checkIfCurrent();
 			return setOutputStream(pos);
 		}
 		finally
@@ -228,12 +111,13 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_setBytes_JB].methodEntry();
 		try
 		{
-			if (bytes == null)	
-			{
+			if (bytes == null || pos < 0) {
 				Object[] messageArguments = new Object[1];
 				messageArguments[0] = "Blob.setBytes(long, byte[])";
 				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
 			}
+			if (pos > 1)
+				throw new SQLFeatureNotSupportedException("Blob.setBytes with position > 1 is not supported");
 			return setBytes(pos, bytes, 0, bytes.length);
 		}
 		finally
@@ -247,162 +131,18 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_setBytes_JBII].methodEntry();
 		try
 		{
-			int endChunkNo;
-			int updOffset;
-			int updLen;
-			int	chunkNo;
-			long lobLenForUpd;
-			int	 byteOffset;
-			int retLen;
-			int totalRetLen;
-			int copyLen;
-			long remLen;
-			long lobLen;
-
-			byte [] tempChunk = null;
-
-			if (pos <= 0 || len < 0 || offset < 0 || bytes == null) 
+			if (pos < 0 || len < 0 || offset < 0 || bytes == null) 
 			{
 				Object[] messageArguments = new Object[1];
 				messageArguments[0] = "Blob.setBytes(long, byte[], int, int)";
 				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
 			}
-			checkIfCurrent();
-			lobLen = length();
-			if (pos > lobLen+1)
-				throw Messages.createSQLException(conn_.locale_,"invalid_position_value", null);
-			copyLen = len;
-			remLen = pos-1+len;	// Length to be either updated or inserted
-			byteOffset = offset;
-			totalRetLen = 0;
-			chunkNo = (int)((pos-1)/ chunkSize_);
-			// calculate the length that can be updated rounded to chunk size
-			if ((lobLen % chunkSize_) == 0)
-				lobLenForUpd = (lobLen / chunkSize_) * chunkSize_;
-			else
-				lobLenForUpd = ((lobLen / chunkSize_)+1) * chunkSize_;
-			if (remLen <= lobLenForUpd)
-				updLen	= len;
-			else
-				updLen = (int)(lobLenForUpd - (pos-1));
-			if (updLen > 0)
-			{
-				updOffset = (int)((pos-1) % chunkSize_);
-				prepareUpdLobDataStmt();		
-
-				synchronized (conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT])
-				{
-					conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setString(4, tableName_);
-					conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setLong(5, dataLocator_);
-				
-					while (true)
-					{
-						// String is 0 based while substring in SQL/MX is 1 based, hence +1
-						conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setInt(6, chunkNo);
-						conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setInt(1, updOffset);
-						if ((updOffset + updLen) <= chunkSize_)
-						{
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setInt(3, updOffset + updLen + 1);
-							if ((byteOffset == 0) && (updLen - updOffset == bytes.length))
-							{
-								conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setBytes(2, bytes);
-							}
-							else
-							{
-								tempChunk = new byte[updLen];
-								System.arraycopy(bytes, byteOffset, tempChunk, 0, updLen);
-								conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setBytes(2, tempChunk);
-							}
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].executeUpdate();
-							totalRetLen += updLen;
-							byteOffset += updLen;
-							chunkNo++;
-							break;
-						}
-						else
-						{
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setInt(3, chunkSize_+1);
-							if (tempChunk == null || tempChunk.length != chunkSize_-updOffset)
-								tempChunk = new byte[chunkSize_-updOffset];
-							System.arraycopy(bytes, byteOffset, tempChunk, 0, chunkSize_-updOffset);
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].setBytes(2, tempChunk);
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT].executeUpdate();
-							totalRetLen += (chunkSize_-updOffset);
-							byteOffset += (chunkSize_-updOffset);
-							updLen -= (chunkSize_-updOffset);
-							chunkNo++;
-						}
-						updOffset = 0;
-					}
-				}
-				copyLen = (int)(remLen - lobLenForUpd);
-				
-				if ((traceWriter_ != null) && 
-					((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-				{
-					traceWriter_.println(getTraceId() 
-						+ "setBytes(" + pos + ",<bytes>," + offset + "," + len 
-						+ ") - UpdLobDataStmt params: tableName_=" + tableName_ 
-						+ " dataLocator_=" + dataLocator_ + " chunkNo=" + chunkNo
-						+ " updOffset=" + updOffset + " updLen=" + updLen
-						+ " remLen=" + remLen + " lobLenForUpd=" + lobLenForUpd 
-						+ " byteOffset=" + byteOffset + " totalRetLen=" + totalRetLen);
-				}
-			}
-
-			tempChunk = null;
-			if (remLen > lobLenForUpd)
-			{
-				while (true)
-				{
-					prepareInsLobDataStmt();
-
-					synchronized (conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT])
-					{
-						conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setString(1, tableName_);
-						conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setLong(2, dataLocator_);
-						conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setInt(3, chunkNo);
-						if (copyLen <= chunkSize_)
-						{
-							if (byteOffset == 0 && copyLen == bytes.length)
-								conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setBytes(4, bytes);
-							else
-							{
-								tempChunk = new byte[copyLen];
-								System.arraycopy(bytes, byteOffset, tempChunk, 0, copyLen);
-								conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setBytes(4, tempChunk);
-							}
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].executeUpdate();
-							totalRetLen += copyLen;
-							break;
-						}
-						else
-						{
-							if (tempChunk == null)
-								tempChunk = new byte[chunkSize_];
-							System.arraycopy(bytes, byteOffset, tempChunk, 0, chunkSize_);
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setBytes(4, tempChunk);
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].executeUpdate();
-							byteOffset += chunkSize_;
-							copyLen -= chunkSize_;
-							totalRetLen += chunkSize_;
-						}
-						chunkNo++;
-					}
-				}
-				
-				if ((traceWriter_ != null) && 
-					((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-				{
-					traceWriter_.println(getTraceId() 
-						+ "setBytes(" + pos + ",<bytes>," + offset + "," + len 
-						+ ") - InsLobDataStmt params: tableName_=" + tableName_ 
-						+ " dataLocator_=" + dataLocator_ + " (total)chunkNo=" + chunkNo
-						+ " copyLen=" + copyLen + " byteOffset=" + byteOffset 
-						+ " totalRetLen=" + totalRetLen);
-				}
-			}
-			return totalRetLen;
+			if (pos > 1)
+				throw new SQLFeatureNotSupportedException("Blob.setBytes with position > 1 is not supported");
+			b_ = bytes;  	
+			length_ = len;
+			offset_ = offset;
+			return len;
 		}
 		finally
 		{
@@ -410,6 +150,49 @@
 		}
 	}
 
+	byte[] getBytes(int inlineLobLen) throws SQLException 
+	{
+		long llength  = inLength();
+		if (llength > Integer.MAX_VALUE) {
+			Object[] messageArguments = new Object[1];
+			messageArguments[0] = "Blob.getBytes(int)";
+			throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
+		}
+		int length = (int)llength;
+		if (length == 0) {
+			if (b_ != null && (b_.length - offset_)  > inlineLobLen)	
+				return null;
+			else
+				return null;
+		} else if (length_ > inlineLobLen)
+			return null;
+		if (b_ != null) {
+			if (length == 0)
+				length = b_.length;
+			if (offset_ == 0) {
+				if (length_ == 0) 
+					return b_;
+				else
+					return Arrays.copyOf(b_, length);
+			}
+			else  
+				return Arrays.copyOfRange(b_, offset_, offset_+length);
+		}
+		if (is_ != null) {
+			try {
+				byte buf[] = new byte[length]; 
+				int retLen = is_.read(buf, offset_, length);
+				if (retLen != length)
+					return Arrays.copyOf(buf, retLen);
+				else
+					return buf; 
+			} catch (IOException ioe) {
+				throw new SQLException(ioe);
+			}
+		}
+		return null;
+	}
+
 	// This function populates the Blob data from one of the following:
 	// 1. InputStream set in PreparedStatement.setBinaryStream
 	// 2. From another clob set in PreparedStatement.setBlob or ResultSet.updateBlob
@@ -422,23 +205,17 @@
 		try
 		{
 			SQLMXLobOutputStream os;
-
+			if (inputLob_ != null) {	
+				is_ = inputLob_.getBinaryStream();
+			} else if (b_ != null) {
+				is_ = new ByteArrayInputStream(b_, offset_, b_.length);
+			}
 			if (is_ != null)
 			{
 				os = (SQLMXLobOutputStream)setOutputStream(1);
-				os.populate(is_, isLength_);
+				os.populate(is_, length_);
 				is_ = null;
 			}
-			else if (inputLob_ != null)
-			{	
-				populateFromBlob();
-				inputLob_ = null;			
-			}
-			else if (b_ != null)
-			{
-				setBytes(1, b_);
-				b_ = null;
-			}
 		}
 		finally
 		{
@@ -446,94 +223,6 @@
 		}
 	}
 
-	void populateFromBlob() throws SQLException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_populateFromBlob].methodEntry();
-		try
-		{
-			long		pos;
-			byte[]		b;
-			int			ret;
-			ResultSet	rs;
-			SQLMXBlob	inputBlob;
-			int			chunkNo = 0;
-		
-			pos = 1;
-			if (inputLob_ instanceof SQLMXBlob)
-			{
-				// When SQL/MX supports insert into a table by selecting some other rows in
-				// the same table, we should change the code to do so
-				// Until then, we read a row and write to the same table with different
-				// data locator till all the rows are read 
-				inputBlob = (SQLMXBlob)inputLob_;
-			
-				prepareGetLobDataStmt();
-				prepareInsLobDataStmt();
-
-				if ((traceWriter_ != null) && 
-					((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-				{
-					traceWriter_.println(getTraceId() 
-						+ "populateFromBlob() - GetLobDataStmt params: tableName_=" + inputBlob.tableName_ 
-						+ " dataLocator_=" + inputBlob.dataLocator_ + " chunkNo=0");
-				}
-
-				synchronized (conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT])
-				{
-					conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setString(1, inputBlob.tableName_);
-					conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setLong(2, inputBlob.dataLocator_);
-					conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setInt(3, 0);	// start ChunkNo
-					conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].setInt(4, Integer.MAX_VALUE);
-					rs = conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT].executeQuery();
-					try
-					{
-						synchronized(conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT])
-						{
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setString(1, tableName_);
-							conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setLong(2, dataLocator_);
-		
-							while (rs.next())
-							{
-								b = rs.getBytes(1);
-								conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setInt(3, chunkNo);
-								conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].setBytes(4, b);
-								conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT].executeUpdate();
-								chunkNo++;
-							}
-						}		
-						
-						if ((traceWriter_ != null) && 
-							((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-						{
-							traceWriter_.println(getTraceId() 
-								+ "populateFromBlob() - InsLobDataStmt params: tableName_=" + tableName_ 
-								+ " dataLocator_=" + dataLocator_ + " (total)chunkNo=" + chunkNo);
-						}
-					} 
-					finally 
-					{
-						rs.close();
-					}
-				}
-			}
-			else
-			{
-				while (true)
-				{
-					b = inputLob_.getBytes(pos, chunkSize_);
-					if (b.length == 0)
-						break;
-					ret = setBytes(pos, b);
-					pos += b.length;
-				}
-			}
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_populateFromBlob].methodExit();
-		}
-	}
-
 	static final int findBytes(byte buf[], int off, int len, byte ptrn[])
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_findBytes].methodEntry();
@@ -569,235 +258,29 @@
 		}
 	}
 
-	// The following methods are used to prepare the LOB statement specific 
-	// to BLOB objects, and re-prepares if the lobTableName_ has changed. 
-	void prepareGetLobLenStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobLenStmt].methodEntry();
-		try
-		{
-			conn_.prepareGetLobLenStmt(lobTableName_,true);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobLenStmt].methodExit();
-		}
-	}
-
-	void prepareDelLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareDelLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareDelLobDataStmt(lobTableName_,true);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareDelLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareGetLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareGetLobDataStmt(lobTableName_,true);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareUpdLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareUpdLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareUpdLobDataStmt(lobTableName_,true);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareUpdLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareInsLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareInsLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareInsLobDataStmt(lobTableName_,true);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareInsLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareTrunLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareTrunLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareTrunLobDataStmt(lobTableName_,true);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareTrunLobDataStmt].methodExit();
-		}
-	}
-	
-	// The following methods are used to return the BLOB prepared statement 
-	// from the connection object PS array for population and execution.
-	PreparedStatement getGetLobLenStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobLenStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_LEN_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobLenStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getDelLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getDelLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.BLOB_DEL_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getDelLobDataStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getTrunLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getTrunLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.BLOB_TRUN_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getTrunLobDataStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getInsLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getInsLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.BLOB_INS_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getInsLobDataStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getUpdLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getUpdLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.BLOB_UPD_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getUpdLobDataStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getGetLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.BLOB_GET_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobDataStmt].methodExit();
-		}
-	}
-
-
 	// Constructors
-	SQLMXBlob(SQLMXConnection connection, String tableName, long dataLocator) throws SQLException
+	public SQLMXBlob(SQLMXConnection connection, String lobLocator) throws SQLException
 	{
-		super(connection, tableName, dataLocator, connection.blobTableName_, true);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJ].methodEntry();
-		try
-		{
-			if (connection.blobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_blobTableName", null);
-		
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJ].methodExit();
-		}
+		super(connection, lobLocator, true);
 	}
 
-	SQLMXBlob(SQLMXConnection connection, String tableName, long dataLocator, InputStream x, 
-			int length) throws SQLException
+	SQLMXBlob(SQLMXConnection connection, String lobLocator, InputStream x, int length) throws SQLException
 	{
-		super(connection, tableName, dataLocator, x, length, connection.blobTableName_, true);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJLI].methodEntry();
-		try
-		{
-			if (connection.blobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_blobTableName", null);
-	
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJLI].methodExit();
-		}
+		super(connection, lobLocator, x, length, true);
 	}
 
-	SQLMXBlob(SQLMXConnection connection, String tableName, long dataLocator, Blob inputLob) throws SQLException
+	SQLMXBlob(SQLMXConnection connection, String lobLocator, Blob inputLob) throws SQLException
 	{
-		super(connection, tableName, dataLocator, connection.blobTableName_, true);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJL].methodEntry();
-		try
-		{
-			if (connection.blobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_blobTableName", null);
-			inputLob_ = inputLob;
-	
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJL].methodExit();
-		}
+		super(connection, lobLocator, true);
+		inputLob_ = inputLob;
 	}
 	
-	SQLMXBlob(SQLMXConnection connection, String tableName, long dataLocator, byte[] b)
-		throws SQLException
+	SQLMXBlob(SQLMXConnection connection, String lobLocator, byte[] b) throws SQLException
 	{
-		super(connection, tableName, dataLocator, connection.blobTableName_, true);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJB].methodEntry();
-		try
-		{
-			if (connection.blobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_blobTableName", null);
-			b_ = b;
-	
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXBlob_LLJB].methodExit();
-		}
+		super(connection, lobLocator, true);
+		b_ = b;
 	}
+
 	public void setTraceId(String traceId_) {
 		this.traceId_ = traceId_;
 	}
@@ -821,11 +304,10 @@
 	}
 
 	// fields
-	private String					traceId_;
-	static PrintWriter		traceWriter_;
-	static int				traceFlag_;
+	private String		traceId_;
+	static PrintWriter	traceWriter_;
+	static int		traceFlag_;
 	Blob			inputLob_;
-	byte[]			b_;
 
 	private static int methodId_getBinaryStream			=  0;
 	private static int methodId_getBytes				=  1;
@@ -841,19 +323,7 @@
 	private static int methodId_SQLMXBlob_LLJLI			= 11;
 	private static int methodId_SQLMXBlob_LLJL			= 12;
 	private static int methodId_SQLMXBlob_LLJB			= 13;
-	private static int methodId_prepareGetLobLenStmt	= 14;
-	private static int methodId_prepareDelLobDataStmt	= 15;
-	private static int methodId_prepareGetLobDataStmt	= 16;
-	private static int methodId_prepareUpdLobDataStmt	= 17;
-	private static int methodId_prepareInsLobDataStmt	= 18;
-	private static int methodId_prepareTrunLobDataStmt	= 19;
-	private static int methodId_getGetLobLenStmt		= 20;
-	private static int methodId_getDelLobDataStmt		= 21;
-	private static int methodId_getTrunLobDataStmt		= 22;
-	private static int methodId_getInsLobDataStmt		= 23;
-	private static int methodId_getUpdLobDataStmt		= 24;
-	private static int methodId_getGetLobDataStmt		= 25;
-	private static int totalMethodIds					= 26;
+	private static int totalMethodIds					= 14;
 	private static JdbcDebug[] debug;
 	
 	static
@@ -876,18 +346,6 @@
 			debug[methodId_SQLMXBlob_LLJLI] = new JdbcDebug(className,"SQLMXBlob[LLJLI]");
 			debug[methodId_SQLMXBlob_LLJL] = new JdbcDebug(className,"SQLMXBlob[LLJL]");
 			debug[methodId_SQLMXBlob_LLJB] = new JdbcDebug(className,"SQLMXBlob[LLJB]");
-			debug[methodId_prepareGetLobLenStmt] = new JdbcDebug(className,"prepareGetLobLenStmt");
-			debug[methodId_prepareDelLobDataStmt] = new JdbcDebug(className,"prepareDelLobDataStmt");
-			debug[methodId_prepareGetLobDataStmt] = new JdbcDebug(className,"prepareGetLobDataStmt");
-			debug[methodId_prepareUpdLobDataStmt] = new JdbcDebug(className,"prepareUpdLobDataStmt");
-			debug[methodId_prepareInsLobDataStmt] = new JdbcDebug(className,"prepareInsLobDataStmt");
-			debug[methodId_prepareTrunLobDataStmt] = new JdbcDebug(className,"prepareTrunLobDataStmt");
-			debug[methodId_getGetLobLenStmt] = new JdbcDebug(className,"getGetLobLenStmt");
-			debug[methodId_getDelLobDataStmt] = new JdbcDebug(className,"getDelLobDataStmt");
-			debug[methodId_getTrunLobDataStmt] = new JdbcDebug(className,"getTrunLobDataStmt");
-			debug[methodId_getInsLobDataStmt] = new JdbcDebug(className,"getInsLobDataStmt");
-			debug[methodId_getUpdLobDataStmt] = new JdbcDebug(className,"getUpdLobDataStmt");
-			debug[methodId_getGetLobDataStmt] = new JdbcDebug(className,"getGetLobDataStmt");
 		}
 	}
 
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 49ae072..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
@@ -1406,14 +1406,14 @@
             synchronized (connection_) {
                 validateExecuteInvocation();
                 if (inputDesc_ != null) {
-                    executeCall(connection_.server_, connection_.getDialogueId_(),
-                            connection_.getTxid_(), connection_.autoCommit_,
+                    executeCall(connection_.server_, connection_.getDialogueId(),
+                            connection_.getTxid(), connection_.autoCommit_,
                             connection_.transactionMode_, stmtId_,
                             inputDesc_.length, getParameters(), queryTimeout_,
                             connection_.iso88591EncodingOverride_);
                 } else
-                executeCall(connection_.server_, connection_.getDialogueId_(),
-                        connection_.getTxid_(), connection_.autoCommit_,
+                executeCall(connection_.server_, connection_.getDialogueId(),
+                        connection_.getTxid(), connection_.autoCommit_,
                         connection_.transactionMode_, stmtId_, 0, null,
                         queryTimeout_,
                         connection_.iso88591EncodingOverride_);
@@ -1472,14 +1472,14 @@
             synchronized (connection_) {
                 validateExecuteInvocation();
                 if (inputDesc_ != null) {
-                    executeCall(connection_.server_, connection_.getDialogueId_(),
-                            connection_.getTxid_(), connection_.autoCommit_,
+                    executeCall(connection_.server_, connection_.getDialogueId(),
+                            connection_.getTxid(), connection_.autoCommit_,
                             connection_.transactionMode_, stmtId_,
                             inputDesc_.length, getParameters(), queryTimeout_,
                             connection_.iso88591EncodingOverride_);
                 } else
-                executeCall(connection_.server_, connection_.getDialogueId_(),
-                        connection_.getTxid_(), connection_.autoCommit_,
+                executeCall(connection_.server_, connection_.getDialogueId(),
+                        connection_.getTxid(), connection_.autoCommit_,
                         connection_.transactionMode_, stmtId_, 0, null,
                         queryTimeout_,
                         connection_.iso88591EncodingOverride_);
@@ -1524,14 +1524,14 @@
             synchronized (connection_) {
                 validateExecuteInvocation();
                 if (inputDesc_ != null) {
-                    executeCall(connection_.server_, connection_.getDialogueId_(),
-                            connection_.getTxid_(), connection_.autoCommit_,
+                    executeCall(connection_.server_, connection_.getDialogueId(),
+                            connection_.getTxid(), connection_.autoCommit_,
                             connection_.transactionMode_, stmtId_,
                             inputDesc_.length, getParameters(), queryTimeout_,
                             connection_.iso88591EncodingOverride_);
                 } else
-                executeCall(connection_.server_, connection_.getDialogueId_(),
-                        connection_.getTxid_(), connection_.autoCommit_,
+                executeCall(connection_.server_, connection_.getDialogueId(),
+                        connection_.getTxid(), connection_.autoCommit_,
                         connection_.transactionMode_, stmtId_, 0, null,
                         queryTimeout_,
                         connection_.iso88591EncodingOverride_);
@@ -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();
@@ -1669,7 +1645,7 @@
                     JdbcDebug.debugLevelStmt, "paramValues_ = "
                     + paramValues_ + ", returnResultSet_ = "
                     + returnResultSet_ + ", connection_.txid_ = "
-                    + connection_.getTxid_() + ", resultSetMax_ = "
+                    + connection_.getTxid() + ", resultSetMax_ = "
                     + resultSetMax_ + ", resultSetIndex_ = "
                     + resultSetIndex_ + ", isSPJResultSet_ = "
                     + isSPJResultSet_);
@@ -1709,16 +1685,6 @@
         }
     }
 
-    SQLMXCallableStatement(SQLMXConnection connection, String moduleName,
-            int moduleVersion, long moduleTimestamp, String stmtName) {
-        super(connection, moduleName, moduleVersion, moduleTimestamp, stmtName,
-                false, connection.holdability_);
-        if (JdbcDebugCfg.entryActive) {
-            debug[methodId_SQLMXCallableStatement_LLIJL].methodEntry();
-            debug[methodId_SQLMXCallableStatement_LLIJL].methodExit();
-        }
-    }
-
     // native methods
     native void prepareCall(String server, long dialogueId, int txid,
             boolean autoCommit, int txnMode, String stmtLabel, String sql,
@@ -1729,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_;
@@ -1823,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 {
@@ -1963,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/SQLMXClob.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClob.java
index 1d9f03b..1a459ad 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClob.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClob.java
@@ -35,6 +35,8 @@
 import java.io.IOException;
 import java.util.Date;
 import java.io.PrintWriter;
+import java.io.StringReader;
+import java.util.Arrays;
 
 public class SQLMXClob extends SQLMXLob implements Clob 
 {
@@ -72,7 +74,6 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_getCharacterStream].methodEntry();
 		try
 		{
-			checkIfCurrent();
 			// Close the reader and inputStream hander over earlier
 			if (reader_ != null)
 			{
@@ -113,147 +114,31 @@
 
 	public String getSubString(long pos, int length) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getSubString].methodEntry();
-		try
-		{
-			int startChunkNo;
-			int endChunkNo;
-			int offset;
-			int copyLen;
-			int dataLength;
-			long clobDataLen;
-			String data;
-			StringBuffer retString;
-
-			if (pos <= 0 || length < 0 )
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "Clob.getSubString(long, int): position is less than or equal to 0, or length is less than 0";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-			
-			
-			// Clob data total length must be larger than pos supplied (used to offset the substring)
-//			clobDataLen = length();
-//			if (pos > clobDataLen) 
-//			{
-//				Object[] messageArguments = new Object[1];
-//				messageArguments[0] = "Clob.getSubString(long, int): position (" + pos + ") exceeds the Clob data length (" + clobDataLen + ")";
-//				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-//			}
-			
-			
-			checkIfCurrent();
-			startChunkNo = (int)((pos-1) / chunkSize_);
-			endChunkNo = (int)((pos-1+length)/ chunkSize_);
-			copyLen = length;
-			offset = (int)((pos-1) % chunkSize_);
-			retString = new StringBuffer(length);
-		
-			prepareGetLobDataStmt();
-
-			if ((traceWriter_ != null) && 
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId() 
-					+ "getSubString(" + pos + "," + length + ") - GetLobDataStmt params: tableName_=" + tableName_ 
-					+ " dataLocator_=" + dataLocator_
-					+ " startChunkNo=" + startChunkNo
-					+ " endChunkNo=" + endChunkNo);
-			}
-
-			synchronized (conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT])
-			{
-				conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setString(1, tableName_);
-				conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setLong(2, dataLocator_);
-				conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setInt(3, startChunkNo);
-				conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setInt(4, endChunkNo);
-				ResultSet rs = conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].executeQuery();
-				try
-				{
-					while (rs.next())
-					{
-						data = rs.getString(1);
-						dataLength = data.length()-offset;
-						
-						if (dataLength >= copyLen)
-						{
-							retString.append(data.substring(offset, offset+copyLen));
-							break;
-						} 
-						else
-						{
-							if (offset == 0)
-								retString.append(data);
-							else
-								retString.append(data.substring(offset));
-							copyLen -= dataLength;
-						}
-						offset = 0;	// reset the offset 
-					}
-				}
-				finally
-				{
-					rs.close();
-				}
-			}
-			return retString.toString();
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getSubString].methodExit();
+	 	long skippedLen;	
+		checkIfCurrent();
+		Reader cr = getCharacterStream();
+		try {
+ 			skippedLen = cr.skip(pos);
+			if (skippedLen < pos)
+				return new String(""); 
+			char[] buf = new char[length];
+			int retLen = cr.read(buf, 0, length);
+			if (retLen < length)
+				buf = Arrays.copyOf(buf, retLen);
+			return new String(buf);
+		} catch (IOException ioe) {
+			throw new SQLException(ioe);
 		}
 	}
 
 	public long position(Clob searchstr, long start) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_position_LJ_clob].methodEntry();
-		try
-		{
-			String searchString;
-		
-			if (start <= 0 )
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "Clob.position(Clob, long)";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-			checkIfCurrent();
-			searchString = searchstr.getSubString(1L,(int)searchstr.length());
-			return position(searchString, start);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_position_LJ_clob].methodExit();
-		}
+		throw new SQLFeatureNotSupportedException("Clob.position(Clob, long) not supported");
 	}
 
 	public long position(String searchstr, long start) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_position_LJ_str].methodEntry();
-		try
-		{
-			String clobData;
-			long retValue;
-
-			if (start <= 0 )
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "Clob.position(String, long)";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-			checkIfCurrent();
-			clobData = getSubString(start, (int)length());
-			retValue = clobData.indexOf(searchstr);
-			if (retValue != -1)
-				retValue += start;
- 
-			return retValue;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_position_LJ_str].methodExit();
-		}
+		throw new SQLFeatureNotSupportedException("Clob.position(String, long) not supported");
 	}
 
 	public OutputStream setAsciiStream(long pos) throws SQLException
@@ -261,9 +146,13 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_setAsciiStream].methodEntry();
 		try
 		{
-			// Check if Autocommit is set, and no external transaction exists
-			checkAutoCommitExtTxn();
-			checkIfCurrent();
+			if (pos < 0) {
+				Object[] messageArguments = new Object[1];
+				messageArguments[0] = "Clob.setAsciiStream(long)";
+				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
+			}
+			if (pos > 1)
+				throw new SQLFeatureNotSupportedException("Clob.setAsciiStream with position > 1 is not supported");
 			// Close the writer and OutputStream hander over earlier
 			if (writer_ != null)
 			{
@@ -293,9 +182,14 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_setCharacterStream].methodEntry();
 		try
 		{
-			// Check if Autocommit is set, and no external transaction exists
-			checkAutoCommitExtTxn();
-			checkIfCurrent();
+			if (pos < 0) {
+				Object[] messageArguments = new Object[1];
+				messageArguments[0] = "Clob.setCharacterStream(long)";
+				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
+			}
+			if (pos > 1)
+				throw new SQLFeatureNotSupportedException("Clob.setCharacterStream with position > 1 is not supported");
+
 			// Close the writer and OutputStream hander over earlier
 			if (writer_ != null)
 			{
@@ -339,12 +233,13 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_setString_JL].methodEntry();
 		try
 		{
-			if (str == null)
-			{
+			if (str == null || pos < 0) {
 				Object[] messageArguments = new Object[1];
 				messageArguments[0] = "Clob.setString(long, String)";
 				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
 			}
+			if (pos > 1)
+				throw new SQLFeatureNotSupportedException("Clob.setString with position > 1 is not supported");
 			return setString(pos, str, 0, str.length());
 		}
 		finally
@@ -358,147 +253,26 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_setString_JLII].methodEntry();
 		try
 		{
-			int endChunkNo;
-			int updOffset;
-			int updLen;
-			int	chunkNo;
-			long lobLenForUpd;
-			int	 strOffset;
-			int retLen;
-			int totalRetLen;
-			int copyLen;
-			long remLen;
-			long lobLen;
-
-			if (str == null || pos <= 0 || len < 0 || offset < 0)
-			{
+			if (str == null || pos < 0 || len < 0 || offset < 0) {
 				Object[] messageArguments = new Object[1];
 				messageArguments[0] = "Clob.setString(long, String, int, int)";
 				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
 			}
-			checkIfCurrent();
-			lobLen = length();
-			if (pos > lobLen+1)
-				throw Messages.createSQLException(conn_.locale_,"invalid_position_value", null);
-			copyLen = len;
-			remLen = pos-1+len; // Length that needs to be either updated or inserted
-			strOffset = offset;
-			totalRetLen = 0;
-			chunkNo = (int)((pos-1)/ chunkSize_);	// Starting chunkNo
-
-			// Calculate the length that can be updated rounded to chunk size
-			if ((lobLen % chunkSize_) == 0)
-				lobLenForUpd = (lobLen / chunkSize_) * chunkSize_;
-			else
-				lobLenForUpd = ((lobLen / chunkSize_)+1) * chunkSize_; // LOB data offset to the first char of the NEXT chunk insertion
-			     
-			if (remLen <= lobLenForUpd)
-				updLen	= len;
-			else
-				updLen = (int)(lobLenForUpd - (pos-1));
-
-			if (updLen > 0)
-			{
-				updOffset = (int)((pos-1) % chunkSize_); // offset from the beginning of the chunk
-				prepareUpdLobDataStmt();
-
-				synchronized (conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT])
-				{
-					conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setString(4, tableName_);
-					conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setLong(5, dataLocator_);
-				
-					while (true)
-					{
-						conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setInt(6, chunkNo);
-						conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setInt(1, updOffset);
-						if ((updOffset + updLen) <= chunkSize_)
-						{
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setInt(3, updOffset + updLen + 1);
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setString(2, str.substring(strOffset, strOffset+updLen));
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].executeUpdate();
-							totalRetLen += updLen;
-							strOffset += updLen;
-							chunkNo++;
-							break;
-						}
-						else
-						{
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setInt(3, chunkSize_+1);
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].setString(2, str.substring(strOffset, strOffset+chunkSize_-updOffset));
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT].executeUpdate();
-							totalRetLen += (chunkSize_-updOffset);
-							strOffset += (chunkSize_-updOffset);
-							updLen -= (chunkSize_-updOffset);
-							chunkNo++;
-						}
-						updOffset = 0;
-					}
-				}
-				copyLen = (int)(remLen - lobLenForUpd);
-
-				if ((traceWriter_ != null) && 
-					((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-				{
-					traceWriter_.println(getTraceId() 
-						+ "setString(" + pos + ",<String>," + offset + "," + len 
-						+ ") - UpdLobDataStmt params: tableName_=" + tableName_ 
-						+ " dataLocator_=" + dataLocator_ + " chunkNo=" + chunkNo
-						+ " updOffset=" + updOffset + " updLen=" + updLen
-						+ " remLen=" + remLen + " lobLenForUpd=" + lobLenForUpd 
-						+ " strOffset=" + strOffset	+ " totalRetLen=" + totalRetLen);
-				}
-			}
-			if (remLen > lobLenForUpd)
-			{
-				while (true)
-				{
-					prepareInsLobDataStmt();
-
-					synchronized (conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT])
-					{
-						conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setString(1, tableName_);
-						conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setLong(2, dataLocator_);
-						conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setInt(3, chunkNo);
-						if (copyLen <= chunkSize_)
-						{
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setString(4, str.substring(strOffset, strOffset+copyLen));
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].executeUpdate();
-							strOffset += copyLen;
-							totalRetLen += copyLen;
-							break;
-						}
-						else
-						{
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setString(4, str.substring(strOffset, strOffset+chunkSize_));
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].executeUpdate();
-							strOffset += chunkSize_;
-							copyLen -= chunkSize_;
-							totalRetLen += chunkSize_;
-						}
-						chunkNo++;
-					}
-				}
-				
-				if ((traceWriter_ != null) && 
-					((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-				{
-					traceWriter_.println(getTraceId() 
-						+ "setString(" + pos + ",<String>," + offset + "," + len 
-						+ ") - InsLobDataStmt params: tableName_=" + tableName_ 
-						+ " dataLocator_=" + dataLocator_ + " (total)chunkNo=" + chunkNo
-						+ " copyLen=" + copyLen + " strOffset=" + strOffset 
-						+ " totalRetLen=" + totalRetLen);
-				}
-			}
-			return totalRetLen;
+			if (pos > 1)
+				throw new SQLFeatureNotSupportedException("Clob.setString with position > 1 is not supported");
+			inputLobStr_ = str;
+			startingPos_ = pos;	
+			length_ = len;
+			offset_ = offset;
 		}
 		finally
 		{
 			if (JdbcDebugCfg.entryActive) debug[methodId_setString_JLII].methodExit();
 		}
+		return len;
 	}
 
-	void close()
+	void close() throws SQLException 
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_close].methodEntry();
 		try
@@ -509,16 +283,17 @@
 					reader_.close();
 				if (writer_ != null)
 					writer_.close();
+				super.close();
 			}
 			catch (IOException e)
 			{
+				throw new SQLException(e);
 			}
 			finally
 			{
 				reader_ = null;
 				writer_ = null;
 			}
-			super.close();
 		}
 		finally
 		{
@@ -526,6 +301,64 @@
 		}
 	}
 
+	long inLength() throws SQLException 
+	{
+		if (inputLobStr_ != null && length_ == 0)
+			return inputLobStr_.length();
+		else
+			return super.inLength();
+	}
+
+	String getString(int inlineLobLen) throws SQLException 
+        {
+		long llength  = inLength();
+		if (llength > Integer.MAX_VALUE) {
+			Object[] messageArguments = new Object[1];
+			messageArguments[0] = "Blob.getString(int)";
+			throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
+		}
+		int length = (int)llength;
+		if (length == 0) {
+			if (inputLobStr_ != null && (inputLobStr_.length() - offset_)  > inlineLobLen)	
+				return null;
+			else
+				return null;
+		}
+		else if (length_ > inlineLobLen)	
+			return null;	
+		if (inputLobStr_ != null) {
+			if (offset_ == 0)
+				return inputLobStr_;
+			else
+				return inputLobStr_.substring(offset_, length+offset_);
+		}
+		if (ir_ != null) {
+			try {
+				char[] cbuf = new char[length];
+				int retLen = ir_.read(cbuf, offset_, length);
+				if (retLen != length)
+					return new String(cbuf, 0, retLen);
+				else
+					return new String(cbuf);
+			} catch (IOException ioe) {
+				throw new SQLException(ioe);
+			}
+		}
+		if (is_ != null) {
+			try {
+				byte buf[] = new byte[length]; 
+				int retLen = is_.read(buf, offset_, length);
+				if (retLen != length)
+					return new String(buf, 0, retLen);
+				else
+					return new String(buf);
+			} catch (IOException ioe) {
+				throw new SQLException(ioe);
+			}
+		}
+		return null;
+ 	}
+
 	// This function populates the Clob data from one of the following:
 	// 1. InputStream set in PreparedStatement.setAsciiStream 
 	// 2. Reader set in PreparedStatement.setCharacterStream
@@ -541,27 +374,30 @@
 			SQLMXLobOutputStream os;
 			SQLMXClobWriter cw;
 
+			if (inputLob_ != null) {
+				is_ = inputLob_.getAsciiStream();
+				ir_ = inputLob_.getCharacterStream();
+			}
+			else if (inputLobStr_ != null) {
+				ir_  = new StringReader(inputLobStr_);
+				try {
+					if (offset_ > 0)
+						ir_.skip(offset_);
+				} catch (IOException ioe) {
+					throw new SQLException(ioe);
+				}
+			}
 			if (is_ != null)
 			{
 				os = (SQLMXLobOutputStream)setOutputStream(1);
-				os.populate(is_, isLength_);
-				is_ = null;
+				os.populate(is_, length_);
+				close();
 			}
 			else if (ir_ != null)
 			{
 				cw = (SQLMXClobWriter)setCharacterStream(1);
-				cw.populate(ir_, irLength_);
-				ir_ = null;
-			}
-			else if (inputLob_ != null)
-			{	
-				populateFromClob();
-				inputLob_ = null;			
-			}
-			else if (inputLobStr_ != null)
-			{
-				setString(1, inputLobStr_);
-				inputLobStr_ = null;
+				cw.populate(ir_, length_);
+				close();
 			}
 		}
 		finally
@@ -570,341 +406,36 @@
 		}
 	}
 	
-	void populateFromClob() throws SQLException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_populateFromClob].methodEntry();
-		try
-		{
-			long		pos;
-			String		s;
-			int			ret;
-			ResultSet	rs;
-			SQLMXClob	inputClob;
-			int			chunkNo = 0;
-			
-			pos = 1;
-			if (inputLob_ instanceof SQLMXClob)
-			{
-				// When SQL/MX supports insert into a table by selecting some other rows in
-				// the same table, we should change the code to do so
-				// Until then, we read a row and write to the same table with different
-				// data locator till all the rows are read 
-				inputClob = (SQLMXClob)inputLob_;
-
-				prepareGetLobDataStmt();
-				prepareInsLobDataStmt();
-
-				if ((traceWriter_ != null) && 
-					((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-				{
-					traceWriter_.println(getTraceId() 
-						+ "populateFromClob() - GetLobDataStmt params: tableName_=" + inputClob.tableName_ 
-						+ " dataLocator_=" + inputClob.dataLocator_ + " chunkNo=0"
-						+ " Integer.MAX_VALUE=" + Integer.MAX_VALUE);
-				}
-
-				synchronized (conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT])
-				{
-					conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setString(1, inputClob.tableName_);
-					conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setLong(2, inputClob.dataLocator_);
-					conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setInt(3, 0);	// start ChunkNo
-					conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].setInt(4, Integer.MAX_VALUE);
-					rs = conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT].executeQuery();
-					try 
-					{
-						synchronized(conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT])
-						{
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setString(1, tableName_);
-							conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setLong(2, dataLocator_);
-					
-							while (rs.next())
-							{
-								s = rs.getString(1);
-								conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setInt(3, chunkNo);
-								conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].setString(4, s);
-								conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT].executeUpdate();
-								chunkNo++;
-							}
-						}
-						
-						if ((traceWriter_ != null) && 
-							((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-						{
-							traceWriter_.println(getTraceId() 
-								+ "populateFromClob() - InsLobDataStmt params: tableName_=" + tableName_ 
-								+ " dataLocator_=" + dataLocator_ + " (total)chunkNo=" + chunkNo);
-						}
-					} 
-					finally 
-					{
-						rs.close();
-					}
-				}
-			}
-			else
-			{
-				while (true)
-				{
-					s = inputLob_.getSubString(pos, chunkSize_);
-					if (s.length() == 0)
-						break;
-					ret = setString(pos, s);
-					pos += s.length();
-				}
-			}
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_populateFromClob].methodExit();
-		}
-	}
-
-	// The following methods are used to prepare the LOB statement specific 
-	// to CLOB objects, and re-prepares if the lobTableName_ has changed. 
-	void prepareGetLobLenStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobLenStmt].methodEntry();
-		try
-		{
-			conn_.prepareGetLobLenStmt(lobTableName_,false);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobLenStmt].methodExit();
-		}
-	}
-	
-	void prepareDelLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareDelLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareDelLobDataStmt(lobTableName_,false);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareDelLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareGetLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareGetLobDataStmt(lobTableName_,false);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareGetLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareUpdLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareUpdLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareUpdLobDataStmt(lobTableName_,false);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareUpdLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareInsLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareInsLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareInsLobDataStmt(lobTableName_,false);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareInsLobDataStmt].methodExit();
-		}
-	}
-	
-	void prepareTrunLobDataStmt() throws SQLException 
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_prepareTrunLobDataStmt].methodEntry();
-		try
-		{
-			conn_.prepareTrunLobDataStmt(lobTableName_,false);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_prepareTrunLobDataStmt].methodExit();
-		}
-	}
-
-	// The following methods are used to return the CLOB prepared statement 
-	// from the connection object PS array for population and execution.
-	PreparedStatement getGetLobLenStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobLenStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_LEN_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobLenStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getDelLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getDelLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.CLOB_DEL_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getDelLobDataStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getTrunLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getTrunLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.CLOB_TRUN_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getTrunLobDataStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getInsLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getInsLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.CLOB_INS_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getInsLobDataStmt].methodExit();
-		}
-	}
-	
-	PreparedStatement getUpdLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getUpdLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.CLOB_UPD_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getUpdLobDataStmt].methodExit();
-		}
-	}
-
-	PreparedStatement getGetLobDataStmt()
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobDataStmt].methodEntry();
-		try
-		{
-			return conn_.LobPrepStmts[SQLMXConnection.CLOB_GET_LOB_DATA_STMT];
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_getGetLobDataStmt].methodExit();
-		}
-	}
-
 	// Constructors
-	SQLMXClob(SQLMXConnection connection, String tableName, long dataLocator) throws SQLException
+	public SQLMXClob(SQLMXConnection connection, String lobLocator) throws SQLException
 	{
-		super(connection, tableName, dataLocator, connection.clobTableName_, false);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJ].methodEntry();
-		try
-		{
-			if (connection.clobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_clobTableName", null);
-
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJ].methodExit();
-		}
+		super(connection, lobLocator, false);
 	}
 
-	SQLMXClob(SQLMXConnection connection, String tableName, long dataLocator, InputStream x, 
-		int length) throws SQLException
+	SQLMXClob(SQLMXConnection connection, String lobLocator, InputStream x, long length) throws SQLException
 	{
-		super(connection, tableName, dataLocator, x, length, connection.clobTableName_, false);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJLI_stream].methodEntry();
-		try
-		{
-			if (connection.clobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_clobTableName", null);
-
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJLI_stream].methodExit();
-		}
+		super(connection, lobLocator, x, length, false);
 	}
 
-	SQLMXClob(SQLMXConnection connection, String tableName, long dataLocator, Reader x, 
-		int length) throws SQLException
+	SQLMXClob(SQLMXConnection connection, String lobLocator, Reader x, long length) throws SQLException
 	{
-		super(connection, tableName, dataLocator, connection.clobTableName_, false);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJLI_reader].methodEntry();
-		try
-		{
-			if (connection.clobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_clobTableName", null);
-			ir_ = x;
-			irLength_ = length;
-	
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJLI_reader].methodExit();
-		}
+		super(connection, lobLocator, false);
+		ir_ = x;
+		length_ = length;
 	}
 	
-	SQLMXClob(SQLMXConnection connection, String tableName, long dataLocator, Clob inputLob) throws SQLException
+	SQLMXClob(SQLMXConnection connection, String lobLocator, Clob inputLob) throws SQLException
 	{
-		super(connection, tableName, dataLocator, connection.clobTableName_, false);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJL_clob].methodEntry();
-		try
-		{
-			if (connection.clobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_clobTableName", null);
-			inputLob_ = inputLob;
-
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJL_clob].methodExit();
-		}
+		super(connection, lobLocator, false);
+		inputLob_ = inputLob;
 	}
 
-	SQLMXClob(SQLMXConnection connection, String tableName, long dataLocator, String lobStr) throws SQLException
+	SQLMXClob(SQLMXConnection connection, String lobLocator, String lobStr) throws SQLException
 	{
-		super(connection, tableName, dataLocator, connection.clobTableName_, false);
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJL_string].methodEntry();
-		try
-		{
-			if (connection.clobTableName_ == null)
-				throw Messages.createSQLException(conn_.locale_,"no_clobTableName", null);
-			inputLobStr_ = lobStr;
-
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClob_LLJL_string].methodExit();
-		}
+		super(connection, lobLocator, false);
+		inputLobStr_ = lobStr;
 	}
+
 	public void setTraceId(String traceId_) {
 		this.traceId_ = traceId_;
 	}
@@ -927,15 +458,16 @@
 	}
 
 	//fields
-	private String				traceId_;
+	private String		traceId_;
 	static PrintWriter	traceWriter_;
-	static int			traceFlag_;
+	static int		traceFlag_;
 	SQLMXClobReader		reader_;
 	SQLMXClobWriter		writer_;
-	Reader				ir_;
-	int					irLength_;
-	Clob				inputLob_;
-	String				inputLobStr_;
+	Reader			ir_;
+	Clob			inputLob_;
+	String			inputLobStr_;
+	long			startingPos_;	
+
 	private static int methodId_getAsciiStream			=  0;
 	private static int methodId_getCharacterStream		=  1;
 	private static int methodId_getSubString			=  2;
@@ -953,19 +485,7 @@
 	private static int methodId_SQLMXClob_LLJLI_reader	= 14;
 	private static int methodId_SQLMXClob_LLJL_clob		= 15;
 	private static int methodId_SQLMXClob_LLJL_string	= 16;
-	private static int methodId_prepareGetLobLenStmt	= 17;
-	private static int methodId_prepareDelLobDataStmt	= 18;
-	private static int methodId_prepareGetLobDataStmt	= 19;
-	private static int methodId_prepareUpdLobDataStmt	= 20;
-	private static int methodId_prepareInsLobDataStmt	= 21;
-	private static int methodId_prepareTrunLobDataStmt	= 22;
-	private static int methodId_getGetLobLenStmt		= 23;
-	private static int methodId_getDelLobDataStmt		= 24;
-	private static int methodId_getTrunLobDataStmt		= 25;
-	private static int methodId_getInsLobDataStmt		= 26;
-	private static int methodId_getUpdLobDataStmt		= 27;
-	private static int methodId_getGetLobDataStmt		= 28;
-	private static int totalMethodIds					= 29;
+	private static int totalMethodIds					= 17;
 	private static JdbcDebug[] debug;
 	
 	static
@@ -991,18 +511,6 @@
 			debug[methodId_SQLMXClob_LLJLI_reader] = new JdbcDebug(className,"SQLMXClob[LLJLI_reader]");
 			debug[methodId_SQLMXClob_LLJL_clob] = new JdbcDebug(className,"SQLMXClob[LLJL_clob]");
 			debug[methodId_SQLMXClob_LLJL_string] = new JdbcDebug(className,"SQLMXClob[LLJL_string]");
-			debug[methodId_prepareGetLobLenStmt] = new JdbcDebug(className,"prepareGetLobLenStmt");
-			debug[methodId_prepareDelLobDataStmt] = new JdbcDebug(className,"prepareDelLobDataStmt");
-			debug[methodId_prepareGetLobDataStmt] = new JdbcDebug(className,"prepareGetLobDataStmt");
-			debug[methodId_prepareUpdLobDataStmt] = new JdbcDebug(className,"prepareUpdLobDataStmt");
-			debug[methodId_prepareInsLobDataStmt] = new JdbcDebug(className,"prepareInsLobDataStmt");
-			debug[methodId_prepareTrunLobDataStmt] = new JdbcDebug(className,"prepareTrunLobDataStmt");
-			debug[methodId_getGetLobLenStmt] = new JdbcDebug(className,"getGetLobLenStmt");
-			debug[methodId_getDelLobDataStmt] = new JdbcDebug(className,"getDelLobDataStmt");
-			debug[methodId_getTrunLobDataStmt] = new JdbcDebug(className,"getTrunLobDataStmt");
-			debug[methodId_getInsLobDataStmt] = new JdbcDebug(className,"getInsLobDataStmt");
-			debug[methodId_getUpdLobDataStmt] = new JdbcDebug(className,"getUpdLobDataStmt");
-			debug[methodId_getGetLobDataStmt] = new JdbcDebug(className,"getGetLobDataStmt");
 		}
 	}
 	public void free() throws SQLException {
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobReader.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobReader.java
index 9d2e46d..e07d0c1 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobReader.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobReader.java
@@ -34,6 +34,7 @@
 import java.io.IOException;
 import java.util.Date;
 import java.io.PrintWriter;
+import java.nio.CharBuffer;
 
 public class SQLMXClobReader extends Reader
 {
@@ -80,15 +81,14 @@
 		{
 			int retValue = 0;
 
-			if (isClosed_)
-				throw new IOException("Reader is in closed state");
+			if (eor_)
+				return -1;
 			if (currentChar_ == charsRead_)
-				retValue = readChunkThrowIO(null, 0, clob_.chunkSize_);
+				retValue = readChunkThrowIO();
 			if (retValue != -1)
 			{
-				retValue = chunk_[currentChar_];
-				if (currentChar_ != charsRead_)
-					currentChar_++;
+				retValue = chunk_.get();
+				currentChar_++;
 			}
 			return retValue;
 		}
@@ -118,50 +118,52 @@
 		int len)
 		throws IOException
 	{
+		return read(cbuf, off, len, false);
+	}
+
+	public int read(char[] cbuf,
+		int off,
+		int len,
+		boolean skip)
+		throws IOException
+	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_read_CII].methodEntry();
 		try
 		{
-			int readLen;
+			int remainLen;
 			int copyLen;
 			int copyOffset;
-			int tempLen = 0;
-			int rowsToRead;
 			int retLen;
+			int availableLen;
+			int copiedLen = 0;
 
-			if (isClosed_)
-				throw new IOException("Reader is in closed state");
 			if (cbuf == null)
 				throw new IOException("Invalid input value");
-			copyLen = len;
+                        if (eor_)
+				return -1;
+			remainLen = len;
 			copyOffset = off;
-			readLen = 0;
-			if (currentChar_ < charsRead_)
-			{
-				if (copyLen+currentChar_ <= charsRead_)
-				{
-					System.arraycopy(chunk_, currentChar_, cbuf, copyOffset, copyLen);
-					currentChar_ += copyLen;
-					readLen = copyLen;
-					return readLen;
-				}
+			while (remainLen > 0) {
+				availableLen = charsRead_ - currentChar_;
+				if (availableLen > remainLen)	
+					copyLen = remainLen;
 				else
-				{
-					tempLen = charsRead_- currentChar_;
-					System.arraycopy(chunk_, currentChar_, cbuf, copyOffset, tempLen);
-					copyOffset += tempLen;
-					copyLen -= tempLen;
-					currentChar_ += tempLen;
+					copyLen = availableLen;
+				if (copyLen > 0) { 
+					if (! skip) 
+						System.arraycopy(chunk_, currentChar_, cbuf, copyOffset, copyLen);
+					currentChar_ += copyLen;
+					copyOffset += copyLen;
+					copiedLen += copyLen;
+					remainLen -= copyLen;
+				}
+				if (remainLen > 0) {
+					retLen = readChunkThrowIO();
+					if (retLen == -1)
+						break;
 				}
 			}
-			readLen = readChunkThrowIO(cbuf, copyOffset, copyLen);
-			if (readLen != -1)
-				retLen = readLen + tempLen;
-			else
-				retLen = tempLen;
-			if (retLen == 0)
-				return -1;
-			else
-				return retLen;
+			return copiedLen;
 		}
 		finally
 		{
@@ -175,11 +177,9 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_reset].methodEntry();
 		try
 		{
-			if (isClosed_)
-				throw new IOException("Reader is in closed state");
 			currentChar_ = 0;
-			currentChunkNo_ = 0;
 			charsRead_ = 0;
+			eor_ = false;
 			return;
 		}
 		finally
@@ -191,210 +191,63 @@
 	public long skip(long n)
 		throws IOException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_skip].methodEntry();
-		try
-		{
-			long charsToSkip;
-			int noOfChunks = 0;
-			int remChars;
-			long retLen = 0;
-			long charsSkipped = 0;
-			int oldChunkNo;
-			int readLen;
-
-			if (isClosed_)
-				throw new IOException("Reader is in closed state");
-			if (n <= 0)
-				return 0;
-			if (currentChar_ + n > charsRead_)
-			{
-				charsSkipped = charsRead_ - currentChar_;
-				charsToSkip = n - charsSkipped;
-				currentChar_ += charsSkipped;
-			}
+		long totalSkippedLen = 0;
+		long skipRemain = n;
+		int skipLen;
+		int skippedLen;
+		while (skipRemain > 0) {
+			if (skipRemain <= Integer.MAX_VALUE)
+				skipLen = (int)skipRemain;
 			else
-			{
-				currentChar_ += n;
-				return n;
-			}
-			noOfChunks += (int)((charsToSkip-1) / clob_.chunkSize_);
-			if ((charsToSkip % clob_.chunkSize_) == 0)
-				remChars = clob_.chunkSize_;
-			else
-				remChars = (int)(charsToSkip % clob_.chunkSize_);
-			oldChunkNo = currentChunkNo_;	// Which is already 1 more
-			currentChunkNo_ = currentChunkNo_ + noOfChunks;
-			retLen = readChunkThrowIO(null, 0, clob_.chunkSize_);
-			if (retLen != -1)
-			{
-				charsSkipped += (currentChunkNo_ - oldChunkNo -1) * clob_.chunkSize_;
-				if (retLen < remChars)
-					remChars= (int)retLen;
-				currentChar_ = remChars;
-				charsSkipped += remChars;
-			}
-			else
-			{
-				if (currentChunkNo_ > 0)
-					readLen = ((currentChunkNo_-1) * clob_.chunkSize_) + currentChar_;
-				else
-					readLen = currentChar_;
-				try
-				{
-					charsSkipped = charsSkipped + clob_.length() - readLen;
-				}
-				catch (SQLException e)
-				{
-					throw new IOException(SQLMXLob.convSQLExceptionToIO(e));
-				}
-				// Exclude the bytes that are in chunk already
-				remChars = (int)(charsSkipped - (charsRead_ - currentChar_));
-				noOfChunks += (int)((remChars-1) / clob_.chunkSize_);
-				currentChunkNo_ = oldChunkNo + noOfChunks;
-				//calculate the bytes in the chunk and set currentChar and charsRead
-				//to reach EOD
-				if (remChars == 0)
-				{
-					currentChar_ = 0;
-					charsRead_ = 0;
-				}
-				else
-				{
-					if ((remChars % clob_.chunkSize_) == 0)
-						currentChar_ = clob_.chunkSize_;
-					else
-						currentChar_ = (int)(remChars % clob_.chunkSize_);
-					charsRead_ = currentChar_;
-				}
-			}
-			return charsSkipped;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_skip].methodExit();
-		}
+				skipLen = Integer.MAX_VALUE;	
+			skippedLen = read(null, 0, skipLen, true); 
+			if (skippedLen == -1)
+				break;
+			skipRemain -= skippedLen;
+			totalSkippedLen += skippedLen;
+		}	
+		return totalSkippedLen;
 	}
 
-	int readChunkThrowIO(char[] c, int off, int len) throws IOException
+	int readChunkThrowIO() throws IOException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_readChunkThrowIO].methodEntry();
-		try
-		{
-			int readLen;
-
-			try
-			{
-				readLen = readChunk(c, off, len);
-			}
-			catch (SQLException e)
-			{
-				throw new IOException(SQLMXLob.convSQLExceptionToIO(e));
-			}
-			return readLen;
+		int readLen;
+		try {
+			readLen = readChunk();
 		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_readChunkThrowIO].methodExit();
+		catch (SQLException e) {
+			throw new IOException(SQLMXLob.convSQLExceptionToIO(e));
 		}
+		return readLen;
 	}
 
-	int readChunk(char[] c, int off, int len) throws SQLException
+	int readChunk() throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_readChunk].methodEntry();
-		try
-		{
-			int rowsToRead;
-			String	data;
-			int copyLen;
-			int	copyOffset;
-			int readLen = 0;
-			int dataLen;
-
-			rowsToRead = (len-1)/clob_.chunkSize_;
-			clob_.prepareGetLobDataStmt();
-			PreparedStatement GetClobDataStmt = clob_.getGetLobDataStmt();
-
-			if ((traceWriter_ != null) && 
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId() 
-					+ "readChunk(<char>," + off + "," + len + ") - GetLobDataStmt params: tableName_=" + clob_.tableName_ 
-					+ " dataLocator_=" + clob_.dataLocator_
-					+ " currentChunkNo_=" + currentChunkNo_
-					+ " currentChunkNo_+rowsToRead=" + (currentChunkNo_+rowsToRead));
-			}
-
-			synchronized (GetClobDataStmt)
-			{
-				GetClobDataStmt.setString(1, clob_.tableName_);
-				GetClobDataStmt.setLong(2, clob_.dataLocator_);
-				GetClobDataStmt.setInt(3, currentChunkNo_);
-				GetClobDataStmt.setInt(4, currentChunkNo_+rowsToRead);
-				ResultSet rs = GetClobDataStmt.executeQuery();
-				copyLen = len;
-				copyOffset = off;
-				try 
-				{
-					while (rs.next())
-					{
-						data = rs.getString(1);
-						currentChunkNo_++;
-						charsRead_ = data.length();
-						dataLen = charsRead_;
-						if (c == null)
-						{
-							data.getChars(0, dataLen, chunk_, 0);
-							readLen += dataLen;
-							currentChar_ = 0;
-							break;
-						}
-						else
-						{
-							if (copyLen >= dataLen)
-							{
-								data.getChars(0, dataLen, c, copyOffset);
-								copyLen -= dataLen;
-								readLen += dataLen;
-								copyOffset += dataLen;
-								currentChar_ = dataLen;
-							} 
-							else
-							{
-								data.getChars(0, copyLen, c, copyOffset);
-								// copy the rest of data to chunk
-								data.getChars(copyLen, dataLen,  chunk_, copyLen);
-								readLen += copyLen;
-								currentChar_ = copyLen;
-								break;
-							}
-						}
-					}
-				} 
-				finally 
-				{
-					rs.close();
-				}
-			}
-			
-			if ((traceWriter_ != null) && 
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId() 
-					+ "readChunk(<char>," + off + "," + len + ") - LOB data read: charsRead_=" + charsRead_ 
-					+ " readLen=" + readLen + " copyLen=" + copyLen + " currentChunkNo_=" + currentChunkNo_);
-			}
-
-			if (readLen == 0)
-				return -1;
-			else
-				return readLen;
+		int extractMode = 1; // get the lob data
+		chunk_.clear(); 
+		if (eor_)
+			return -1;
+		if (charsRead_ != 0 && (charsRead_ < clob_.chunkSize_)) {
+			eor_ = true;
+			extractMode = 2; // Close the extract
 		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_readChunk].methodExit();
-		}
+		charsRead_ = readChunk(conn_.server_, conn_.getDialogueId(), conn_.getTxid(), extractMode, clob_.lobLocator_, chunk_); 
+		if (charsRead_ == -1) {
+			extractMode = 2; // close the extract
+		 	readChunk(conn_.server_, conn_.getDialogueId(), conn_.getTxid(), extractMode, clob_.lobLocator_, chunk_); 
+			eor_ = true;
+			chunk_.limit(0);
+		} else if (charsRead_ == 0) {
+			charsRead_ = -1;
+			eor_ = true;
+			chunk_.limit(0);
+		} else
+			chunk_.limit(charsRead_);
+		return charsRead_;
 	}
 
+        native int readChunk(String server, long dialogueId, long txid,  int extractMode, String lobLocator, CharBuffer buffer);
+
 	// constructors
 	SQLMXClobReader(SQLMXConnection connection, SQLMXClob clob)
 	{
@@ -403,17 +256,19 @@
 		{
 			clob_ = clob;
 			conn_ = connection;
-			chunk_ = new char[clob_.chunkSize_];
-
+			chunk_ = CharBuffer.allocate(clob_.chunkSize_);
+			currentChar_ = 0;
+			charsRead_ = 0;
+			eor_ = false;
+			isClosed_ = false;
 			traceWriter_ = SQLMXDataSource.traceWriter_;
-			
-			
 		}
 		finally
 		{
 			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXClobReader].methodExit();
 		}
 	}
+
 	public void setTraceId(String traceId_) {
 		this.traceId_ = traceId_;
 	}
@@ -434,16 +289,17 @@
 	}
 
 	// Fields 
-	private String				traceId_;
+	private String		traceId_;
 	static PrintWriter	traceWriter_;
-	static int			traceFlag_;
-	SQLMXClob			clob_;
+	static int		traceFlag_;
+	SQLMXClob		clob_;
 	SQLMXConnection		conn_;
-	boolean				isClosed_;
-	char[]				chunk_;
-	int					currentChar_;
-	int					currentChunkNo_;
-	int					charsRead_;
+	boolean			isClosed_;
+	CharBuffer		chunk_;
+	int			currentChar_;
+	int			charsRead_;
+	boolean			eor_;
+	
 
 	private static int methodId_close				=  0;
 	private static int methodId_mark				=  1;
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobWriter.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobWriter.java
index a489c3e..63f7552 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobWriter.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXClobWriter.java
@@ -64,7 +64,8 @@
 				throw new IOException("Output stream is in closed state");
 			if (! isFlushed_)
 			{
-				writeChunkThrowIO(null);
+				writeChunkThrowIO(chunk_, 0, currentChar_);
+				currentChar_ = 0;
 			}
 		}
 		finally
@@ -106,33 +107,25 @@
 					"length or offset is less than 0 or offset is greater than the length of array");
 			srcOffset = off;
 			copyLen = len;
-			while (true)
-			{
-				if (copyLen+currentChar_ < (clob_.chunkSize_))
-				{
+			while (true) {
+				if ((copyLen+currentChar_) < (clob_.chunkSize_)) {
 					System.arraycopy(cbuf, srcOffset, chunk_, currentChar_, copyLen);
 					currentChar_ += copyLen;
 					isFlushed_ = false;
 					break;
-				}
-				else
-				{
-					if (currentChar_ != 0)
-					{
+				} else {
+					if (currentChar_ != 0) {
 						tempLen = clob_.chunkSize_-currentChar_;
 						System.arraycopy(cbuf, srcOffset, chunk_, currentChar_, tempLen);
 						currentChar_ += tempLen;
-						writeChunkThrowIO(null);
-					}
-					else
-					{
+						writeChunkThrowIO(chunk_, 0, currentChar_);
+						currentChar_ = 0;
+					} else {
 						tempLen = clob_.chunkSize_;
-						currentChar_ += tempLen;
-						writeChunkThrowIO(new String(cbuf, srcOffset, tempLen));
+						writeChunkThrowIO(cbuf, srcOffset, tempLen);
 					}
 					copyLen -= tempLen;
 					srcOffset += tempLen;
-					currentChar_ = 0;
 				}
 			}
 		}
@@ -152,8 +145,10 @@
 			chunk_[currentChar_] = (char)c;
 			isFlushed_ = false;
 			currentChar_++;
-			if (currentChar_ == clob_.chunkSize_)
-				writeChunkThrowIO(null);
+			if (currentChar_ == clob_.chunkSize_) {
+				writeChunkThrowIO(chunk_, 0, currentChar_);
+				currentChar_ = 0;
+			}
 		}
 		finally
 		{
@@ -181,45 +176,40 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_write_LII].methodEntry();
 		try
 		{
+			int copyLen;
+			int srcOffset;
 			int tempLen;
-			int writeLen;
-			int srcOff;
-
-			writeLen = len;
-			srcOff = off;
 
 			if (isClosed_)
-				throw new IOException("Writer is in closed state");
+				throw new IOException("Output stream is in closed state");
 			if (str == null)
 				throw new IOException("Invalid input value");
-			if (currentChar_ != 0)
-			{
-				tempLen = clob_.chunkSize_ - currentChar_;
-				if (writeLen > tempLen)
-				{		
-					char[] cbuf = new char[tempLen];
-					str.getChars(srcOff, srcOff+tempLen, cbuf, 0);
-					write(cbuf, 0, cbuf.length);
-					writeLen -= tempLen;
-					srcOff += tempLen;
-				}
-			}
-			while (writeLen > 0)
-			{
-				if (writeLen < clob_.chunkSize_)
+			if (off < 0 || len < 0 || off > str.length())
+				throw new IndexOutOfBoundsException(
+					"length or offset is less than 0 or offset is greater than the length of array");
+			srcOffset = off;
+			copyLen = len;
+			while (true) {
+				if ((copyLen+currentChar_) < clob_.chunkSize_) {
+					System.arraycopy(str, srcOffset, chunk_, currentChar_, copyLen);
+					currentChar_ += copyLen;
+					isFlushed_ = false;
 					break;
-				else
-				{
-					writeChunkThrowIO(str.substring(srcOff, srcOff+clob_.chunkSize_));
-					writeLen -= clob_.chunkSize_;
-					srcOff += clob_.chunkSize_;
+				} else {
+					if (currentChar_ != 0) {
+						tempLen = clob_.chunkSize_-currentChar_;		
+						System.arraycopy(str, srcOffset, chunk_, currentChar_, tempLen);
+						currentChar_ += tempLen;
+						writeChunkThrowIO(chunk_, 0, currentChar_);
+						currentChar_ = 0;
+					} else {
+						tempLen = clob_.chunkSize_;
+						writeChunkThrowIO(str.toCharArray(), srcOffset, tempLen);
+					}	
+					copyLen -= tempLen;
+					srcOffset += tempLen;
 				}
-			}
-			if (writeLen != 0)
-			{
-				char[] cbuf = new char[writeLen];
-				str.getChars(srcOff, srcOff+writeLen, cbuf, 0);
-				write(cbuf, 0, cbuf.length);
+				
 			}
 		}
 		finally
@@ -228,82 +218,14 @@
 		}
 	}
 
-	void writeChunk(String str) throws SQLException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_writeChunk].methodEntry();
-		try
-		{
-			String tempStr;
-	
-			if (currentChunkNo_ > updChunkNo_)
-			{
-				clob_.prepareInsLobDataStmt();
-				PreparedStatement InsClobDataStmt = clob_.getInsLobDataStmt();
-
-				synchronized (InsClobDataStmt)
-				{
-					InsClobDataStmt.setString(1, clob_.tableName_);
-					InsClobDataStmt.setLong(2, clob_.dataLocator_);
-					InsClobDataStmt.setInt(3, currentChunkNo_);
-					if (str == null)
-					{
-						if (currentChar_ != clob_.chunkSize_)
-							tempStr = new String(chunk_, 0, currentChar_);
-						else
-							tempStr = new String(chunk_);	
-					}
-					else
-						tempStr = str;
-					InsClobDataStmt.setString(4, tempStr);
-					InsClobDataStmt.executeUpdate();
-					currentChunkNo_++;
-					currentChar_ = 0;
-				}
-			}
-			else
-			{
-				clob_.prepareUpdLobDataStmt();
-				PreparedStatement UpdClobDataStmt = clob_.getUpdLobDataStmt();
-
-				synchronized (UpdClobDataStmt)
-				{
-					UpdClobDataStmt.setString(4, clob_.tableName_);
-					UpdClobDataStmt.setLong(5, clob_.dataLocator_);
-					UpdClobDataStmt.setInt(6, currentChunkNo_);
-					UpdClobDataStmt.setInt(1, updOffset_);
-					if (str == null)
-					{
-						if (updOffset_ != 0 || currentChar_ != clob_.chunkSize_)
-							tempStr = new String(chunk_, updOffset_, currentChar_-updOffset_);
-						else
-							tempStr = new String(chunk_);	
-					}
-					else
-						tempStr = str;		
-					UpdClobDataStmt.setInt(3, currentChar_+1);
-					UpdClobDataStmt.setString(2, tempStr);
-					UpdClobDataStmt.executeUpdate();
-					currentChunkNo_++;
-					currentChar_ = 0;
-					updOffset_ = 0;
-				}
-			}
-			isFlushed_ = true;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_writeChunk].methodExit();
-		}
-	}
-
-	void writeChunkThrowIO(String str) throws IOException
+	void writeChunkThrowIO(char[] chunk, int offset, int len) throws IOException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_writeChunkThrowIO].methodEntry();
 		try
 		{
 			try
 			{
-				writeChunk(str);
+				writeChunk(chunk, offset, len);
 			}
 			catch (SQLException e)
 			{
@@ -315,14 +237,22 @@
 			if (JdbcDebugCfg.entryActive) debug[methodId_writeChunkThrowIO].methodExit();
 		}
 	}
+
+	void writeChunk(char[] chunk, int offset, int len) throws SQLException
+	{
+		writeChunk(conn_.server_, conn_.getDialogueId(), conn_.getTxid(),
+				clob_.lobLocator_, new String(chunk, offset, len), startingPos_-1+offset);
+ 	}
+
+	native void writeChunk(String server, long dialogueId, long txid, String lobLocator, String chunk, long pos);
 	
-	void populate(Reader ir, int length) throws SQLException
+	void populate(Reader ir, long length) throws SQLException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_populate].methodEntry();
 		try
 		{
 			int tempLen;
-			int readLen;
+			long readLen;
 			int retLen;
 				
 			readLen = length;
@@ -331,36 +261,15 @@
 				while (readLen > 0)
 				{
 					if (readLen <= clob_.chunkSize_)
-						tempLen = readLen;
+						tempLen = (int)readLen;
 					else
 						tempLen = clob_.chunkSize_;
 					retLen = ir.read(chunk_, 0, tempLen);
 					if (retLen == -1)
 						break;
 					currentChar_ = retLen;
-
-					if ((traceWriter_ != null) && 
-						((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-					{
-						// For tracing, only print the 1st and last LOB data chunk write info to limit 
-						// potential overflow of buffer for trace output.
-						if (readLen==length) 			// 1st writeChunk
-						{
-							traceWriter_.println(getTraceId() 
-								+ "populate() -  First writeChunk data: tableName_=" + clob_.tableName_
-								+ " dataLocator_=" + clob_.dataLocator_ + " length=" + length 
-								+ " currentChunkNo_=" + currentChunkNo_ + " updChunkNo_=" + updChunkNo_ + " retLen=" + retLen);
-						}
-						if (readLen<=clob_.chunkSize_)	// last writeChunk (NOTE: last chunk can be exactly chunkSize_)
-						{
-							traceWriter_.println(getTraceId() 
-								+ "populate() -  Last writeChunk data: tableName_=" + clob_.tableName_
-								+ " dataLocator_=" + clob_.dataLocator_ + " length=" + length 
-								+ " currentChunkNo_=" + currentChunkNo_ + " updChunkNo_=" + updChunkNo_ + " retLen=" + retLen);
-						}
-					}
-
-					writeChunk(null);
+					writeChunk(chunk_, 0, currentChar_);
+					currentChar_ = 0;
 					readLen -= retLen;
 				}
 			}
@@ -387,27 +296,14 @@
 			long length;
 		
 			clob_ = clob;
-			length = clob_.length();
+			length = clob_.inLength();
 			conn_ = connection;
 			if (pos < 1 || pos > length+1)
 				throw Messages.createSQLException(conn_.locale_,"invalid_position_value", null);
 			startingPos_ = pos;
 			chunk_ = new char[clob_.chunkSize_];
 			isFlushed_ = false;
-			if (length == 0)
-				updChunkNo_ = -1;
-			else
-			{
-				if ((length % clob_.chunkSize_) == 0)
-					updChunkNo_ = (int)(length / clob_.chunkSize_)-1;
-				else
-					updChunkNo_ = (int)(length / clob_.chunkSize_);
-			}
-			currentChunkNo_ = (int)((pos-1)/ clob_.chunkSize_);
-			currentChar_ = (int)((pos-1) % clob_.chunkSize_);
-			updOffset_ = (int)((pos-1) % clob_.chunkSize_);
-
-		
+			currentChar_ = 0;
 		}
 		finally
 		{
@@ -436,19 +332,16 @@
 	}
 
 	// Fields
-	private String				traceId_;
+	private String		traceId_;
 	static PrintWriter	traceWriter_;
-	static int			traceFlag_;
-	SQLMXClob			clob_;
-	long				startingPos_;
+	static int		traceFlag_;
+	SQLMXClob		clob_;
+	long			startingPos_;
 	SQLMXConnection		conn_;
-	boolean				isClosed_;
-	char[]				chunk_;
-	int					currentChar_;
-	int					currentChunkNo_;
-	boolean				isFlushed_;
-	int					updChunkNo_;
-	int					updOffset_;
+	boolean			isClosed_;
+	char[]			chunk_;
+	int			currentChar_;
+	boolean			isFlushed_;
 
 	private static int methodId_close				=  0;
 	private static int methodId_flush				=  1;
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 0f0835d..22ceb77 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
@@ -62,8 +62,6 @@
 import java.util.concurrent.Executor;
 
 import javax.sql.PooledConnection;
-//import com.tandem.tmf.Current;		// Linux port - ToDo
-//import com.tandem.util.FSException;	// Linux port - ToDo
 
 public class SQLMXConnection extends PreparedStatementManager implements
 java.sql.Connection {
@@ -229,7 +227,7 @@
             debug[methodId_commit].traceOut(JdbcDebug.debugLevelEntry,
                     "beginTransFlag_ = " + beginTransFlag_
                     + "; autoCommit_ = " + autoCommit_
-                    + "; txid_ = " + getTxid_());
+                    + "; txid_ = " + getTxid());
             if (JdbcDebugCfg.entryActive)
             debug[methodId_commit].methodExit();
         }
@@ -582,7 +580,7 @@
 
             if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
             printIdMapEntry(cstmt);
-            cstmt.prepareCall(server_, getDialogueId_(), getTxid_(),
+            cstmt.prepareCall(server_, getDialogueId(), getTxid(),
                     autoCommit_, transactionMode_, cstmt.getStmtLabel_(),
                     cstmt.sql_.trim(), cstmt.queryTimeout_,
                     cstmt.resultSetHoldability_, cstmt.fetchSize_);
@@ -666,7 +664,7 @@
             }
             if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
             printIdMapEntry(cstmt);
-            cstmt.prepareCall(server_, getDialogueId_(), getTxid_(),
+            cstmt.prepareCall(server_, getDialogueId(), getTxid(),
                     autoCommit_, transactionMode_, cstmt.getStmtLabel_(),
                     cstmt.sql_.trim(), cstmt.queryTimeout_,
                     cstmt.resultSetHoldability_, cstmt.fetchSize_);
@@ -757,7 +755,7 @@
 
             if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
             printIdMapEntry(cstmt);
-            cstmt.prepareCall(server_, getDialogueId_(), getTxid_(),
+            cstmt.prepareCall(server_, getDialogueId(), getTxid(),
                     autoCommit_, transactionMode_, cstmt.getStmtLabel_(),
                     cstmt.sql_.trim(), cstmt.queryTimeout_,
                     cstmt.resultSetHoldability_, cstmt.fetchSize_);
@@ -848,6 +846,8 @@
 //				batchBindingSizePrev = batchBindingSize_;
 //				batchBindingSize_ = 0;
 //			}
+//
+/*  Selva
             if ( pstmt.getSqlType() != SQLMXConnection.TYPE_INSERT
                     && pstmt.getSqlType() != SQLMXConnection.TYPE_INSERT_PARAM
                     && pstmt.getSqlType() != SQLMXConnection.TYPE_UPDATE
@@ -858,25 +858,12 @@
                 batchBindingSizePrev = this.t2props.getBatchBinding();
                 batchBindingSize_ = 0;
             }
+*/
 
-            // 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
@@ -884,6 +871,7 @@
 //
 //				batchBindingSize_ = batchBindingSizePrev;
 //			}
+/*
             if (pstmt.getSqlType() != SQLMXConnection.TYPE_INSERT
                     && pstmt.getSqlType() != SQLMXConnection.TYPE_INSERT_PARAM
                     && pstmt.getSqlType() != SQLMXConnection.TYPE_UPDATE
@@ -893,6 +881,7 @@
                 batchBindingSize_ = batchBindingSizePrev;
             }
             // End
+*/
 
             if (isStatementCachingEnabled()) {
                 addPreparedStatement(this, pstmt.sql_.trim(), pstmt,
@@ -914,70 +903,6 @@
         }
     }
 
-    // Do not add LOB statements to the statement cache.
-    // Set as protected to allow SQLMXDataLocator calls.
-    /*
-     * RFE: Connection synchronization prepareLobStatement() is now synchronized
-     */
-protected synchronized PreparedStatement prepareLobStatement(String sql)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareLobStatement].methodEntry();
-        if (JdbcDebugCfg.traceActive)
-        debug[methodId_prepareLobStatement].methodParameters("sql=" + sql);
-        try {
-            SQLMXPreparedStatement stmt;
-
-            clearWarnings();
-            if (isClosed_)
-            throw Messages.createSQLException(null, "invalid_connection",
-                    null);
-
-            stmt = new SQLMXPreparedStatement(this, sql);
-
-            if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
-            printIdMapEntry(stmt);
-
-            // not insert
-            int batchBindingSizePrev = 0;
-//			if (SQLMXConnection.getSqlStmtType(sql) != SQLMXConnection.TYPE_INSERT
-//					&& SQLMXConnection.getSqlStmtType(sql) != SQLMXConnection.TYPE_INSERT_PARAM) {
-//
-//				batchBindingSizePrev = batchBindingSize_;
-//				batchBindingSize_ = 0;
-//			}
-            if (stmt.getSqlType() != SQLMXConnection.TYPE_INSERT
-                    && stmt.getSqlType() != SQLMXConnection.TYPE_INSERT_PARAM
-                    && stmt.getSqlType() != SQLMXConnection.TYPE_UPDATE
-                    && stmt.getSqlType() != SQLMXConnection.TYPE_DELETE
-            ) {
-
-                batchBindingSizePrev = this.t2props.getBatchBinding();
-                batchBindingSize_ = 0;
-            }
-
-            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
-                    && stmt.getSqlType() != SQLMXConnection.TYPE_UPDATE
-                    && stmt.getSqlType() != SQLMXConnection.TYPE_DELETE
-            )
-            {
-
-                batchBindingSize_ = batchBindingSizePrev;
-            }
-
-            return stmt;
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareLobStatement].methodExit();
-        }
-    }
-
 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
     throws SQLException {
         if (out_ != null)
@@ -1098,7 +1023,7 @@
 
             if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
             printIdMapEntry(stmt);
-
+/*
             // is not insert
             int batchBindingSizePrev = 0;
             if (stmt.getSqlType() != SQLMXConnection.TYPE_INSERT
@@ -1107,31 +1032,20 @@
                 batchBindingSizePrev = this.t2props.getBatchBinding();
                 batchBindingSize_ = 0;
             }
+*/
 
-            // 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_(),
+                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) {
 
                 batchBindingSize_ = batchBindingSizePrev;
             }
+*/
             if (isStatementCachingEnabled()) {
                 addPreparedStatement(this, stmt.sql_.trim(), stmt,
                         resultSetType, resultSetConcurrency, holdability_);
@@ -1216,7 +1130,8 @@
 
             if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
             printIdMapEntry(stmt);
-
+/*
+            batchBindingSizePrev = this.t2props.getBatchBinding();
             // is not insert
             int batchBindingSizePrev = 0;
             if (stmt.getSqlType() != SQLMXConnection.TYPE_INSERT
@@ -1226,32 +1141,20 @@
                 batchBindingSize_ = 0;
             }
 
-            // 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_(),
+*/
+                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) {
 
                 batchBindingSize_ = batchBindingSizePrev;
             }
-
+*/
             if (isStatementCachingEnabled()) {
                 addPreparedStatement(this, stmt.sql_.trim(), stmt,
                         resultSetType, resultSetConcurrency,
@@ -1377,7 +1280,7 @@
             debug[methodId_rollback_V].traceOut(JdbcDebug.debugLevelEntry,
                     "beginTransFlag_ = " + beginTransFlag_
                     + "; autoCommit_ = " + autoCommit_
-                    + "; txid_ = " + getTxid_());
+                    + "; txid_ = " + getTxid());
             if (JdbcDebugCfg.entryActive)
             debug[methodId_rollback_V].methodExit();
         }
@@ -1440,7 +1343,7 @@
                 if (autoCommit_ != autoCommit)
                 {
                     if (connectInitialized_)
-                    setAutoCommit(server_, getDialogueId_(), autoCommit);
+                    setAutoCommit(server_, getDialogueId(), autoCommit);
                     autoCommit_ = autoCommit;
                 }
             }
@@ -1466,7 +1369,7 @@
             throw Messages.createSQLException(locale_,
                     "invalid_connection", null);
             if (catalog != null) {
-                setCatalog(server_, getDialogueId_(), catalog);
+                setCatalog(server_, getDialogueId(), catalog);
                 if (!catalog.startsWith("\""))
                 catalog_ = catalog.toUpperCase();
                 else
@@ -1613,7 +1516,7 @@
                 case TRANSACTION_REPEATABLE_READ:
                 case TRANSACTION_SERIALIZABLE:
                 // Check if connection is open
-                setTransactionIsolation(server_, getDialogueId_(),
+                setTransactionIsolation(server_, getDialogueId(),
                         mapTxnIsolation(level));
                 transactionIsolation_ = level;
                 updateConnectionReusability(SQL_SET_TRANSACTION);
@@ -1648,98 +1551,6 @@
         }
     }
 
-    /*
-     * RFE: Connection synchronization cpqPrepareStatement() is now
-     * synchronized.
-     */
-    // Method to be used by SQLJ-O
-public synchronized PreparedStatement cpqPrepareStatement(
-            String moduleName, int moduleVersion, long moduleTimestamp,
-            String stmtName, boolean isSelect) throws SQLException {
-        if (out_ != null) {
-            out_.println(getTraceId() + "cpqPrepareStatement(\"" + moduleName
-                    + "\"," + moduleTimestamp + ", \"" + stmtName + "\", \""
-                    + isSelect + ")");
-        }
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_cpqPrepareStatement].methodEntry();
-        try {
-            SQLMXPreparedStatement pstmt;
-
-            if (isClosed_)
-            throw Messages.createSQLException(locale_,
-                    "invalid_connection", null);
-            gcStmts();
-            pstmt = new SQLMXPreparedStatement(this, moduleName, moduleVersion,
-                    moduleTimestamp, stmtName, isSelect, holdability_);
-            addElement(pstmt);
-
-            if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
-            printIdMapEntry(pstmt);
-
-            pstmt.cpqPrepareJNI(server_, getDialogueId_(), getTxid_(),
-                    autoCommit_, transactionMode_, pstmt.moduleName_,
-                    pstmt.moduleVersion_, pstmt.moduleTimestamp_, pstmt
-                    .getStmtLabel_(), pstmt.isSelect_,
-                    pstmt.queryTimeout_, pstmt.resultSetHoldability_,
-                    batchBindingSize_, pstmt.fetchSize_, "",false);
-            if (out_ != null) {
-                out_.println(getTraceId() + "cpqPrepareStatement(\"" + moduleName
-                        + "\"," + moduleTimestamp + ", \"" + stmtName + "\", \""
-                        + isSelect + ") returns PreparedStatement ["
-                        + pstmt.getStmtLabel_() + "]");
-            }
-            if (out_ != null) {
-                return new TPreparedStatement(pstmt, out_);
-            }
-            return pstmt;
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_cpqPrepareStatement].methodExit();
-        }
-    }
-
-    // Method to be used by SQLJ-O
-public CallableStatement cpqPrepareCall(String moduleName,
-            int moduleVersion, long moduleTimestamp, String stmtName)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_cpqPrepareCall].methodEntry();
-        if (JdbcDebugCfg.traceActive)
-        debug[methodId_cpqPrepareCall].methodParameters("moduleName="
-                + moduleName + ", moduleVersion=" + moduleVersion
-                + ", moduleTimestamp=" + moduleTimestamp + ", stmtName="
-                + stmtName);
-        try {
-            SQLMXCallableStatement cstmt;
-
-            if (isClosed_)
-            throw Messages.createSQLException(locale_,
-                    "invalid_connection", null);
-            gcStmts();
-            cstmt = new SQLMXCallableStatement(this, moduleName, moduleVersion,
-                    moduleTimestamp, stmtName);
-            addElement(cstmt);
-
-            if (this.t2props.getEnableLog().equalsIgnoreCase("ON"))
-            printIdMapEntry(cstmt);
-
-            cstmt.cpqPrepareCall(server_, getDialogueId_(), getTxid_(),
-                    autoCommit_, transactionMode_, cstmt.moduleName_,
-                    cstmt.moduleVersion_, cstmt.moduleTimestamp_, cstmt
-                    .getStmtLabel_(), cstmt.queryTimeout_,
-                    cstmt.resultSetHoldability_, cstmt.fetchSize_);
-            return cstmt;
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_cpqPrepareCall].methodExit();
-        }
-    }
-
-    /*
-     * RFE: Connection synchronization begintransaction() is now synchronized.
-     */
-    // Method to be used by SQLJ-O
 public synchronized void begintransaction() throws SQLException {
         if (JdbcDebugCfg.entryActive)
         debug[methodId_begintransaction].methodEntry();
@@ -1749,11 +1560,11 @@
             if (isClosed_)
             throw Messages.createSQLException(locale_,
                     "invalid_connection", null);
-            if (getTxid_() != 0)
+            if (getTxid() != 0)
             throw Messages.createSQLException(locale_,
                     "invalid_transaction_state", null);
 
-            txid = beginTransaction(server_, getDialogueId_());
+            txid = beginTransaction(server_, getDialogueId());
             if (txid != 0) {
                 setTxid_(txid);
                 autoCommit_ = false;
@@ -1837,7 +1648,7 @@
                     if (stmtObject != null) {
                         stmtId = stmtObject.intValue();
                         try {
-                            SQLMXStatement.close(server_, getDialogueId_(),
+                            SQLMXStatement.close(server_, getDialogueId(),
                                     stmtId, true);
                         } catch (SQLException e) {
                         }finally {
@@ -1895,34 +1706,19 @@
         //int status =0;
         try {
             if (!connectInitialized_) {
-                /*		status = tx.get_status();
-                 if(status == com.tandem.tmf.Current.StatusNoTransaction){
-                 tx.begin();
-                 }*/
                 try {
-                    boolean blnCQD = System.getProperty(
-                            "t2jdbc.cqdDoomUserTxn", "OFF").equalsIgnoreCase(
-                            "ON")
-                    || System.getProperty("cqdDoomUserTxn", "OFF")
-                    .equalsIgnoreCase("ON");
-                    // MFC added two more parameters
-
-                    connectInit(server_, getDialogueId_(), catalog_, schema_,
-                            mploc_, isReadOnly_, autoCommit_,
+                    connectInit(server_, getDialogueId(), catalog_, schema_,
+                            isReadOnly_, autoCommit_,
                             mapTxnIsolation(transactionIsolation_),
-                            loginTimeout_, queryTimeout_, enableMFC_,
-                            compiledModuleLocation_, blnCQD,
+                            loginTimeout_, queryTimeout_, 
                             statisticsIntervalTime_, statisticsLimitTime_, statisticsType_, programStatisticsEnabled_, statisticsSqlPlanEnabled_
                     );
 
                     if (iso88591EncodingOverride_ != null)
-                    setCharsetEncodingOverride(server_, getDialogueId_(),
+                    setCharsetEncodingOverride(server_, getDialogueId(),
                             SQLMXDesc.SQLCHARSETCODE_ISO88591,
                             iso88591EncodingOverride_);
                 } catch (SQLException e) {
-                    /*	if(status == com.tandem.tmf.Current.StatusNoTransaction){
-                     tx.rollback();
-                     }*/
                     if (pc_ != null)
                     pc_.sendConnectionErrorEvent(e);
                     else
@@ -1930,20 +1726,9 @@
                     throw e;
                 }
                 connectInitialized_ = true;
-                /*	if(status == com.tandem.tmf.Current.StatusNoTransaction){
-                 tx.rollback();
-                 }*/
             }
 
         }
-        /*catch (FSException e) {
-         if(status == com.tandem.tmf.Current.StatusNoTransaction){
-         try {
-         tx.rollback();
-         } catch (FSException e1) {
-         }
-         }
-         }*/
         finally {
             if (JdbcDebugCfg.entryActive)
             debug[methodId_connectInit].methodExit();
@@ -2019,8 +1804,8 @@
                          */
                         if (!listOfCachedPrepStmtIds.contains(stmtIds.get(i))) {
                             try {
-                                // getDialogueId_()
-                                SQLMXStatement.close(server_, getDialogueId_(),
+                                // getDialogueId()
+                                SQLMXStatement.close(server_, getDialogueId(),
                                         ((Long) stmtIds.get(i)).intValue(),
                                         true);
                             } catch (SQLException se) {
@@ -2066,7 +1851,7 @@
                     for (int i = 0; i < size; i++) {
                         try {
                             SQLMXStatement
-                            .close(server_, getDialogueId_(),
+                            .close(server_, getDialogueId(),
                                     ((Long) stmtIds.get(i))
                                     .longValue(), true);
                         } catch (SQLException se) {
@@ -2078,38 +1863,13 @@
                 }
                 // Need to logically close the statement
                 // Rollback the Transaction independent of autoCommit mode
-                if (getTxid_() != 0) {
+                if (getTxid() != 0) {
                     try {
-                        rollback(server_, getDialogueId_(), getTxid_());
+                        rollback(server_, getDialogueId(), getTxid());
                     } catch (SQLException se1) {
                     }
                     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 {
@@ -2118,7 +1878,7 @@
                     out_.println(getTraceId() +"close()"+" Connection Hard closed");
                     out_.println(getTraceId() + "close(hardClose="+hardClose +",sendEvents="+sendEvents+")");
                 }
-                if (getDialogueId_() == 0)
+                if (getDialogueId() == 0)
                 return;
                 // close all the statements
                 Set<WeakReference> ks1 = refToStmt_.keySet();
@@ -2143,9 +1903,9 @@
                 refToStmt_.clear();
                 // Need to logically close the statement
                 // Rollback the Transaction independent of autoCommit mode
-                if (getTxid_() != 0) {
+                if (getTxid() != 0) {
                     try {
-                        rollback(server_, getDialogueId_(), getTxid_());
+                        rollback(server_, getDialogueId(), getTxid());
                     } catch (SQLException se1) {
                     }
                     setTxid_(0);
@@ -2154,14 +1914,14 @@
                 clearPreparedStatementsAll();
                 // Close the connection
                 try {
-                    // getDialogueId_(),setDialogueId_()
-                    SQLMXConnection.close(server_, getDialogueId_());
+                    // getDialogueId(),setDialogueI_()
+                    SQLMXConnection.close(server_, getDialogueId());
                 }finally {
                     isClosed_ = true;
                     keyForMap=this.incrementAndGetkeyForMapCounter();
-                    mapOfClosedDialogs.put(keyForMap, getDialogueId_());
+                    mapOfClosedDialogs.put(keyForMap, getDialogueId());
 
-                    setDialogueId_(0);
+                    setDialogueId(0);
                     removeElement();
                 }
             }
@@ -2179,8 +1939,8 @@
         debug[methodId_reuse].methodEntry(JdbcDebug.debugLevelPooling);
         try {
             if (connReuseBitMap_ != 0) {
-                connectReuse(server_, getDialogueId_(), connReuseBitMap_,
-                        dsCatalog_, dsSchema_, mploc_,
+                connectReuse(server_, getDialogueId(), connReuseBitMap_,
+                        dsCatalog_, dsSchema_, 
                         TRANSACTION_READ_COMMITTED);
                 // Reset all connection attribute values
                 catalog_ = dsCatalog_;
@@ -2188,7 +1948,6 @@
                 transactionIsolation_ = TRANSACTION_READ_COMMITTED;
                 connReuseBitMap_ = 0;
             }
-            mploc_ = dsMploc_;
             batchBindingSize_ = dsBatchBindingSize_;
             autoCommit_ = true;
             isReadOnly_ = false;
@@ -2228,39 +1987,10 @@
             debug[methodId_updateConnectionReusability].methodExit();
         }
     }
-
-    long getDataLocator(String lobTableName, boolean isBlob)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_getDataLocator].methodEntry();
-        if (JdbcDebugCfg.traceActive)
-        debug[methodId_getDataLocator].methodParameters("lobTableName="
-                + lobTableName + ", isBlob=" + isBlob);
-        try {
-            SQLMXDataLocator dataLoc;
-
-            if (lobTableName == null) {
-                if (isBlob)
-                throw Messages.createSQLException(locale_,
-                        "no_blobTableName", null);
-                throw Messages.createSQLException(locale_, "no_clobTableName",
-                        null);
-            }
-            dataLoc = (SQLMXDataLocator) lobTableToDataLoc_.get(lobTableName);
-            if (dataLoc == null) {
-                dataLoc = new SQLMXDataLocator(this, lobTableName);
-                lobTableToDataLoc_.put(lobTableName, dataLoc);
-            }
-            return dataLoc.getDataLocator(this, isBlob);
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_getDataLocator].methodExit();
-        }
-    }
-
+    //
     // Extension method for WLS, this method gives the pooledConnection object
     // associated with the given connection object.
-public PooledConnection getPooledConnection() throws SQLException {
+    public PooledConnection getPooledConnection() throws SQLException {
         if (JdbcDebugCfg.entryActive)
         debug[methodId_getPooledConnection]
         .methodEntry(JdbcDebug.debugLevelPooling);
@@ -2340,245 +2070,9 @@
         }
     }
 
-    // The following methods ensure that the LOB statements are only prepared
-    // for the
-    // BLOB/CLOB specific PreparedStatement objects (to avoid constant
-    // re-prepares), and
-    // that they are only re-prepared if the appropriate BLOB/CLOB lobTableName_
-    // has changed.
-    void prepareGetLobLenStmt(String lobTableName, boolean isBlob)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareGetLobLenStmt].methodEntry();
-        try {
-            if (isBlob
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[BLOB_GET_LOB_LEN_STMT]))) {
-                String lobLenSQL = "select sum(char_length(lob_data)) from "
-                + lobTableName
-                + " where table_name = ? and data_locator = ?";
-                LobPrepStmts[BLOB_GET_LOB_LEN_STMT] = prepareLobStatement(lobLenSQL);
-                LobPrepStmtTableName[BLOB_GET_LOB_LEN_STMT] = lobTableName;
-            } else if ((!isBlob)
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[CLOB_GET_LOB_LEN_STMT]))) {
-                String lobLenSQL = "select sum(char_length(lob_data)) from "
-                + lobTableName
-                + " where table_name = ? and data_locator = ?";
-                LobPrepStmts[CLOB_GET_LOB_LEN_STMT] = prepareLobStatement(lobLenSQL);
-                LobPrepStmtTableName[CLOB_GET_LOB_LEN_STMT] = lobTableName;
-            }
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareGetLobLenStmt].methodExit();
-        }
-    }
-
-    void prepareDelLobDataStmt(String lobTableName, boolean isBlob)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareDelLobDataStmt].methodEntry();
-        try {
-            if (isBlob
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[BLOB_DEL_LOB_DATA_STMT]))) {
-                String lobDelSQL = "delete from "
-                + lobTableName
-                + " where table_name = ? and data_locator = ? and chunk_no >= ? and chunk_no <= ?";
-                LobPrepStmts[BLOB_DEL_LOB_DATA_STMT] = prepareLobStatement(lobDelSQL);
-                LobPrepStmtTableName[BLOB_DEL_LOB_DATA_STMT] = lobTableName;
-            } else if ((!isBlob)
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[CLOB_DEL_LOB_DATA_STMT]))) {
-                String lobDelSQL = "delete from "
-                + lobTableName
-                + " where table_name = ? and data_locator = ? and chunk_no >= ? and chunk_no <= ?";
-                LobPrepStmts[CLOB_DEL_LOB_DATA_STMT] = prepareLobStatement(lobDelSQL);
-                LobPrepStmtTableName[CLOB_DEL_LOB_DATA_STMT] = lobTableName;
-            }
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareDelLobDataStmt].methodExit();
-        }
-    }
-
-    void prepareGetLobDataStmt(String lobTableName, boolean isBlob)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareGetLobDataStmt].methodEntry();
-        try {
-            if (isBlob
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[BLOB_GET_LOB_DATA_STMT]))) {
-                String lobGetSQL = "select lob_data from "
-                + lobTableName
-                + " where table_name = ? and data_locator = ? and chunk_no >= ? and chunk_no <= ?";
-                LobPrepStmts[BLOB_GET_LOB_DATA_STMT] = prepareLobStatement(lobGetSQL);
-                LobPrepStmtTableName[BLOB_GET_LOB_DATA_STMT] = lobTableName;
-            } else if ((!isBlob)
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[CLOB_GET_LOB_DATA_STMT]))) {
-                String lobGetSQL = "select lob_data from "
-                + lobTableName
-                + " where table_name = ? and data_locator = ? and chunk_no >= ? and chunk_no <= ?";
-                LobPrepStmts[CLOB_GET_LOB_DATA_STMT] = prepareLobStatement(lobGetSQL);
-                LobPrepStmtTableName[CLOB_GET_LOB_DATA_STMT] = lobTableName;
-            }
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareGetLobDataStmt].methodExit();
-        }
-    }
-
-    void prepareUpdLobDataStmt(String lobTableName, boolean isBlob)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareUpdLobDataStmt].methodEntry();
-        try {
-            if (isBlob
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[BLOB_UPD_LOB_DATA_STMT]))) {
-                String lobUpdSQL = "update "
-                + lobTableName
-                + " set lob_data = subString(lob_data, 1, ?) || cast (? as varchar(24000)) || substring(lob_data from ?) where table_name = ? and data_locator = ? and chunk_no = ?";
-                LobPrepStmts[BLOB_UPD_LOB_DATA_STMT] = prepareLobStatement(lobUpdSQL);
-                LobPrepStmtTableName[BLOB_UPD_LOB_DATA_STMT] = lobTableName;
-            } else if ((!isBlob)
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[CLOB_UPD_LOB_DATA_STMT]))) {
-                String lobUpdSQL = "update "
-                + lobTableName
-                + " set lob_data = subString(lob_data, 1, ?) || cast (? as varchar(24000)) || substring(lob_data from ?) where table_name = ? and data_locator = ? and chunk_no = ?";
-                LobPrepStmts[CLOB_UPD_LOB_DATA_STMT] = prepareLobStatement(lobUpdSQL);
-                LobPrepStmtTableName[CLOB_UPD_LOB_DATA_STMT] = lobTableName;
-            }
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareUpdLobDataStmt].methodExit();
-        }
-    }
-    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();
-        }
-    }
-
-    void prepareInsLobDataStmt(String lobTableName, boolean isBlob)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareInsLobDataStmt].methodEntry();
-        try {
-            if (isBlob
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[BLOB_INS_LOB_DATA_STMT]))) {
-                String lobInsSQL = "insert into "
-                + lobTableName
-                + " (table_name, data_locator, chunk_no, lob_data) values (?,?,?,?)";
-                LobPrepStmts[BLOB_INS_LOB_DATA_STMT] = prepareLobStatement(lobInsSQL);
-                LobPrepStmtTableName[BLOB_INS_LOB_DATA_STMT] = lobTableName;
-            } else if ((!isBlob)
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[CLOB_INS_LOB_DATA_STMT]))) {
-                String lobInsSQL = "insert into "
-                + lobTableName
-                + " (table_name, data_locator, chunk_no, lob_data) values (?,?,?,?)";
-                LobPrepStmts[CLOB_INS_LOB_DATA_STMT] = prepareLobStatement(lobInsSQL);
-                LobPrepStmtTableName[CLOB_INS_LOB_DATA_STMT] = lobTableName;
-            }
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareInsLobDataStmt].methodExit();
-        }
-    }
-
-    void prepareTrunLobDataStmt(String lobTableName, boolean isBlob)
-    throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareTrunLobDataStmt].methodEntry();
-        try {
-            if (isBlob
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[BLOB_TRUN_LOB_DATA_STMT]))) {
-                String lobTrunSQL = "update "
-                + lobTableName
-                + " set lob_data = substring(lob_data, 1, ?) where table_name = ? and data_locator = ? and chunk_no = ?";
-                LobPrepStmts[BLOB_TRUN_LOB_DATA_STMT] = prepareLobStatement(lobTrunSQL);
-                LobPrepStmtTableName[BLOB_TRUN_LOB_DATA_STMT] = lobTableName;
-            } else if ((!isBlob)
-                    && !(lobTableName
-                            .equals(LobPrepStmtTableName[CLOB_TRUN_LOB_DATA_STMT]))) {
-                String lobTrunSQL = "update "
-                + lobTableName
-                + " set lob_data = substring(lob_data, 1, ?) where table_name = ? and data_locator = ? and chunk_no = ?";
-                LobPrepStmts[CLOB_TRUN_LOB_DATA_STMT] = prepareLobStatement(lobTrunSQL);
-                LobPrepStmtTableName[CLOB_TRUN_LOB_DATA_STMT] = lobTableName;
-            }
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareTrunLobDataStmt].methodExit();
-        }
-    }
-
-    boolean prepareGetStrtDataLocStmt(String lobTableName, boolean isBlob,
-            String ucs2) throws SQLException {
-        if (JdbcDebugCfg.entryActive)
-        debug[methodId_prepareGetStrtDataLocStmt].methodEntry();
-        try {
-            String lobGetStrtDataLocSQL;
-
-            if (isBlob
-                    && (!(lobTableName
-                                    .equals(LobPrepStmtTableName[BLOB_GET_STRT_DATA_LOC_STMT])) || LobPrepStmtTableName[BLOB_GET_STRT_DATA_LOC_STMT] == null)) {
-                lobGetStrtDataLocSQL = "select * from (update "
-                + lobTableName
-                + " set lob_data = cast(cast(cast(lob_data as largeint) + ? as largeint) as varchar(100)) where table_name = 'ZZDATA_LOCATOR' and data_locator = 0 and chunk_no = 0 return cast(old.lob_data as largeint)+1) as tab1";
-                LobPrepStmts[BLOB_GET_STRT_DATA_LOC_STMT] = prepareLobStatement(lobGetStrtDataLocSQL);
-                LobPrepStmtTableName[BLOB_GET_STRT_DATA_LOC_STMT] = lobTableName;
-                return true;
-            } else if ((!isBlob)
-                    && (!(lobTableName
-                                    .equals(LobPrepStmtTableName[CLOB_GET_STRT_DATA_LOC_STMT])) || LobPrepStmtTableName[CLOB_GET_STRT_DATA_LOC_STMT] == null)) {
-                if (ucs2.equals(UCS_STR)) // Unicode data
-                {
-                    lobGetStrtDataLocSQL = "select * from (update "
-                    + lobTableName
-                    + " set lob_data = cast(cast(cast(lob_data as largeint) + ? as largeint) as varchar(100) character set UCS2) where table_name = 'ZZDATA_LOCATOR' and data_locator = 0 and chunk_no = 0 return cast(old.lob_data as largeint)+1) as tab1";
-                } else // ISO data
-                {
-                    lobGetStrtDataLocSQL = "select * from (update "
-                    + lobTableName
-                    + " set lob_data = cast(cast(cast(lob_data as largeint) + ? as largeint) as varchar(100)) where table_name = 'ZZDATA_LOCATOR' and data_locator = 0 and chunk_no = 0 return cast(old.lob_data as largeint)+1) as tab1";
-                }
-                LobPrepStmts[CLOB_GET_STRT_DATA_LOC_STMT] = prepareLobStatement(lobGetStrtDataLocSQL);
-                LobPrepStmtTableName[CLOB_GET_STRT_DATA_LOC_STMT] = lobTableName;
-                return true;
-            }
-            return false;
-        }finally {
-            if (JdbcDebugCfg.entryActive)
-            debug[methodId_prepareGetStrtDataLocStmt].methodExit();
-        }
-    }
-
     // Log the JDBC SQL statement and the STMTID to the idMapFile if the
     // enableLog_ property is set.
-private void printIdMapEntry(SQLMXStatement stmt) {
+    private void printIdMapEntry(SQLMXStatement stmt) {
         SQLMXDataSource.prWriter_.println("["
                 + T2Driver.dateFormat.format(new java.util.Date()) + "] "
                 + stmt.getStmtLabel_() + " (" + stmt.sql_.trim() + ")\n");
@@ -2605,13 +2099,12 @@
 //			catalog_ = T2Driver.catalog_;
 //			schema_ = T2Driver.schema_;
 //			locale_ = T2Driver.locale_;
-//			mploc_ = T2Driver.mploc_;
 //			batchBindingSize_ = T2Driver.batchBindingSize_;
 //
 //			connectionTimeout_ = 60;
 
-            setDialogueId_(connect(server_, uid_, pwd_));
-            if (getDialogueId_() == 0)
+            setDialogueId(connect(server_, uid_, pwd_));
+            if (getDialogueId() == 0)
             return;
             isClosed_ = false;
             byteSwap_ = false;
@@ -2658,13 +2151,13 @@
 
             initConnectionProps(t2props);
 
-            setDialogueId_(connect(server_, uid_, pwd_));
-            if (getDialogueId_() == 0)
+            setDialogueId(connect(server_, uid_, pwd_));
+            if (getDialogueId() == 0)
             return;
             isClosed_ = false;
             byteSwap_ = false;
 
-            setIsSpjRSFlag(getDialogueId_(), t2props.isSpjrsOn());
+            setIsSpjRSFlag(getDialogueId(), t2props.isSpjrsOn());
 
             refQ_ = new ReferenceQueue<SQLMXStatement>();
             refToStmt_ = new HashMap<WeakReference, Long>();
@@ -2707,8 +2200,8 @@
 
             initConnectionProps(t2props);
 
-            setDialogueId_(connect(server_, uid_, pwd_));
-            if (getDialogueId_() == 0)
+            setDialogueId(connect(server_, uid_, pwd_));
+            if (getDialogueId() == 0)
             return;
             isClosed_ = false;
             byteSwap_ = false;
@@ -2761,39 +2254,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.
@@ -2865,14 +2325,12 @@
     // private native void setReadOnly(String server, int dialogueId, boolean
     // readOnly);
 private native void connectInit(String server, long dialogueId,
-            String catalog, String schema, String mploc, boolean isReadOnly, boolean autoCommit,
+            String catalog, String schema, 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;
 
 private native void connectReuse(String server, long dialogueId,
-            int conResetValue, String catalog, String schema, String mploc,
+            int conResetValue, String catalog, String schema, 
             int transactionIsolation) throws SQLException;
 
 private native long connect(String server, String uid, String pwd);
@@ -2890,8 +2348,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;
 
@@ -2900,15 +2356,15 @@
 //		this.txIDPerThread.set(new Integer(txid_));
     }
 
-public int getTxid_() {
+public int getTxid() {
         return txid_;
 //		return this.txIDPerThread.get().intValue();
     }
 
-public void setDialogueId_(long dialogueId_) throws SQLException {
+public void setDialogueId(long dialogueId_) throws SQLException {
         this.dialogueId_ = dialogueId_;
     }
-public long getDialogueId_() throws SQLException {
+public long getDialogueId() throws SQLException {
         if(dialogueId_ != 0) {
             if(mapOfClosedDialogs.containsKey(this.keyForMap)) {
                 throw new SQLException(Long.toHexString(mapOfClosedDialogs.get(this.keyForMap)) + " Connection is already closed.");
@@ -2941,38 +2397,17 @@
         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();
         transactionMode_ = mapTxnMode(info.getTransactionMode());
         catalog_ = info.getCatalog();
         schema_ = info.getSchema();
-
+        inlineLobChunkSize_ = info.getInlineLobChunkSize();
+        lobChunkSize_ = info.getLobChunkSize();
         String lang = info.getLanguage();
         if (lang == null)
-        locale_ = Locale.getDefault();
+            locale_ = Locale.getDefault();
         else {
             if (lang.equalsIgnoreCase("ja"))
             locale_ = new Locale("ja", "", "");
@@ -2981,14 +2416,9 @@
             else
             locale_ = Locale.getDefault();
         }
-        mploc_ = info.getMploc();
         batchBindingSize_ = info.getBatchBinding();
         connectionTimeout_ = 60;
         loginTimeout_ = info.getLoginTimeout();
-        enableMFC_ = info.getEnableMFC();
-        compiledModuleLocation_ = info.getCompiledModuleLocation();
-        blobTableName_ = info.getBlobTableName();
-        clobTableName_ = info.getClobTableName();
         contBatchOnError_ = info.getContBatchOnError();
         iso88591EncodingOverride_ = info.getIso88591EncodingOverride();
 
@@ -3001,7 +2431,6 @@
 
         dsCatalog_ = catalog_;
         dsSchema_ = schema_;
-        dsMploc_ = mploc_;
         dsBatchBindingSize_ = batchBindingSize_;
         dsTransactionMode_ = transactionMode_;
         dsIso88591EncodingOverride_ = iso88591EncodingOverride_;
@@ -3032,23 +2461,15 @@
         return ++keyForMapCounter;
     }
 
-    // static fields
-    // statics setup to index LobPrepStmtTableName[] and LobPrepStmts[]
-    // for the appropriate LOB prepared statements.
-public static final int CLOB_INS_LOB_DATA_STMT = 0;
-public static final int CLOB_GET_LOB_DATA_STMT = 1;
-public static final int CLOB_GET_LOB_LEN_STMT = 2;
-public static final int CLOB_DEL_LOB_DATA_STMT = 3;
-public static final int CLOB_TRUN_LOB_DATA_STMT = 4;
-public static final int CLOB_UPD_LOB_DATA_STMT = 5;
-public static final int CLOB_GET_STRT_DATA_LOC_STMT = 6;
-public static final int BLOB_INS_LOB_DATA_STMT = 7;
-public static final int BLOB_GET_LOB_DATA_STMT = 8;
-public static final int BLOB_GET_LOB_LEN_STMT = 9;
-public static final int BLOB_DEL_LOB_DATA_STMT = 10;
-public static final int BLOB_TRUN_LOB_DATA_STMT = 11;
-public static final int BLOB_UPD_LOB_DATA_STMT = 12;
-public static final int BLOB_GET_STRT_DATA_LOC_STMT = 13;
+    public int getInlineLobChunkSize()
+    {
+        return inlineLobChunkSize_;
+    }
+
+    public int getLobChunkSize()
+    {
+        return lobChunkSize_;
+    }
 
 public static final int SQL_TXN_READ_UNCOMMITTED = 1;
 public static final int SQL_TXN_READ_COMMITTED = 2;
@@ -3075,19 +2496,7 @@
 public static final int SQL_SET_TRANSACTION_FLAG = 0x0001;
 
     // Fields
-    static int reserveDataLocator_;
-    static HashMap<String, SQLMXDataLocator> lobTableToDataLoc_;
     static long rsCount_;
-
-    PreparedStatement InsLobDataStmt_;
-    PreparedStatement GetLobDataStmt_;
-    PreparedStatement GetLobLenStmt_;
-    PreparedStatement DelLobDataStmt_;
-    PreparedStatement TrunLobDataStmt_;
-    PreparedStatement UpdLobDataStmt_;
-
-    String clobTableName_;
-    String blobTableName_;
     boolean beginTransFlag_ = false;
     String server_;
     String dsn_;
@@ -3103,7 +2512,9 @@
     int loginTimeout_;
     int queryTimeout_;
     int connectionTimeout_;
-private long dialogueId_;
+    int inlineLobChunkSize_;
+    int lobChunkSize_;
+    private long dialogueId_;
     int hClosestmtCount=0;
     int lClosestmtCount=0;
     int pStmtCount=0;
@@ -3116,11 +2527,10 @@
     String statisticsSqlPlanEnabled_;
 
     boolean byteSwap_;
-private int txid_;
+    private int txid_;
     //ThreadLocal<Integer> txIDPerThread;
     Map<String, Class<?>> userMap_;
     Locale locale_;
-    String mploc_;
     ReferenceQueue<SQLMXStatement> refQ_;
     HashMap<WeakReference, Long> refToStmt_;
     boolean connectInitialized_;
@@ -3128,9 +2538,6 @@
     int batchBindingSize_;
     String contBatchOnError_;
     boolean contBatchOnErrorval_;
-    String enableMFC_;
-    String compiledModuleLocation_;
-
     WeakReference<SQLMXConnection> pRef_;
     SQLMXDataSource ds_;
     SQLMXPooledConnection pc_;
@@ -3143,23 +2550,12 @@
 
     String dsCatalog_;
     String dsSchema_;
-    String dsMploc_;
 
     // Bit-mapped value that corresponds to what SQL connection
     // attribute statements that have been executed within the connection
     // context
     int connReuseBitMap_;
 
-    // Array used to store lob table name used when LOB statements are prepared.
-    // If the table names differ from one call to the next, the stmt will
-    // be re-prepared, and the new LOB table name will be saved off.
-    // Initialized to false, one each for the BLOB/CLOB statements listed above.
-    String[] LobPrepStmtTableName = new String[14];
-
-    // Array used to store the LOB prepared statements, indexed by
-    // the statement type statics that follow.
-    PreparedStatement[] LobPrepStmts = new PreparedStatement[14];
-
     // Cache area for character set
     static String getCharsetEncodingCached_server;
     static long getCharsetEncodingCached_dialogueId;
@@ -3202,37 +2598,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_prepareLobStatement = 52;
-private static int methodId_mapTxnMode = 53;
-private static int methodId_mapTxnModeToString = 54;
-private static int methodId_initSetDefaults = 55;
-private static int methodId_prepareGetLobLenStmt = 56;
-private static int methodId_prepareDelLobDataStmt = 57;
-private static int methodId_prepareGetLobDataStmt = 58;
-private static int methodId_prepareUpdLobDataStmt = 59;
-private static int methodId_prepareInsLobDataStmt = 60;
-private static int methodId_prepareTrunLobDataStmt = 61;
-private static int methodId_prepareGetStrtDataLocStmt = 62;
-private static int methodId_getCharsetEncodingCached = 63;
-private static int methodId_getSchema = 64;
-private static int totalMethodIds = 65;
+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 {
@@ -3297,10 +2683,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,
@@ -3328,56 +2710,24 @@
                     "SQLMXConnection[LL_ds]");
             debug[methodId_SQLMXConnection_LL_pool] = new JdbcDebug(className,
                     "SQLMXConnection[LL_pool]");
-            debug[methodId_prepareLobStatement] = new JdbcDebug(className,
-                    "prepareLobStatement");
             debug[methodId_mapTxnMode] = new JdbcDebug(className, "mapTxnMode");
             debug[methodId_mapTxnModeToString] = new JdbcDebug(className,
                     "mapTxnModeToString");
             debug[methodId_initSetDefaults] = new JdbcDebug(className,
                     "initSetDefaults");
-            debug[methodId_prepareGetLobLenStmt] = new JdbcDebug(className,
-                    "prepareGetLobLenStmt");
-            debug[methodId_prepareDelLobDataStmt] = new JdbcDebug(className,
-                    "prepareDelLobDataStmt");
-            debug[methodId_prepareGetLobDataStmt] = new JdbcDebug(className,
-                    "prepareGetLobDataStmt");
-            debug[methodId_prepareUpdLobDataStmt] = new JdbcDebug(className,
-                    "prepareUpdLobDataStmt");
-            debug[methodId_prepareInsLobDataStmt] = new JdbcDebug(className,
-                    "prepareInsLobDataStmt");
-            debug[methodId_prepareTrunLobDataStmt] = new JdbcDebug(className,
-                    "prepareTrunLobDataStmt");
-            debug[methodId_prepareGetStrtDataLocStmt] = new JdbcDebug(
-                    className, "prepareGetStrtDataLocStmt");
             debug[methodId_getCharsetEncodingCached] = new JdbcDebug(className,
                     "getCharsetEncodingCached");
         }
 
-        String reserveDataLocator = System
-        .getProperty("t2jdbc.reserveDataLocator");
-        if (reserveDataLocator != null) {
-            try {
-                reserveDataLocator_ = Integer.parseInt(reserveDataLocator);
-            } catch (NumberFormatException e) {
-            }
-        }
-        if (reserveDataLocator_ == 0)
-        reserveDataLocator_ = 100;
-        lobTableToDataLoc_ = new HashMap<String, SQLMXDataLocator>();
     }
     int dsBatchBindingSize_;
     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;
@@ -3394,13 +2744,11 @@
     }
 
 public Clob createClob() throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+	return new SQLMXClob(this, null);
     }
 
 public Blob createBlob() throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return new SQLMXBlob(this, null);
     }
 
 public NClob createNClob() throws SQLException {
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDataLocator.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDataLocator.java
deleted file mode 100644
index 487c436..0000000
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDataLocator.java
+++ /dev/null
@@ -1,368 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-/* -*-java-*-
- * Filename    : SQLMXDataLocator.java
- * Description : For each clobTableName or blobTableName property, an 
- *     instance of this object will be created.
- *
- */
-
-package org.apache.trafodion.jdbc.t2;
-
-import java.sql.*;
-//import com.tandem.tmf.*;		// Linux port - ToDo
-import java.util.Date;
-import java.io.PrintWriter;
-
-class SQLMXDataLocator {
-	synchronized long getDataLocator(SQLMXConnection conn, boolean isBlob)
-			throws SQLException {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_getDataLocator].methodEntry();
-		try {
-			isBlob_ = isBlob;
-			// This method is synchronized to ensure that the two different
-			// threads will not reserve
-			// data locator,
-			if (startDataLocator_ == 0
-					|| ((currentDataLocator_ - startDataLocator_ + 1) == SQLMXConnection.reserveDataLocator_))
-				currentDataLocator_ = getStartDataLocator(conn);
-			else
-				currentDataLocator_++;
-			return currentDataLocator_;
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_getDataLocator].methodExit();
-		}
-	}
-
-	long getStartDataLocator(SQLMXConnection conn) throws SQLException {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_getStartDataLocator].methodEntry();
-
-/* Linux port - ToDo tmf.jar related
-		try {
-			Current tx = null;
-			ControlRef cref = null;
-			boolean txBegin = false;
-			int currentTxid = conn.getTxid_();
-			conn.setTxid_(0);
-
-			try {
-				tx = new Current();
-				// Suspend the existing transaction, suspend returns null if
-				// there is none
-				cref = tx.suspend();
-				tx.begin();
-				txBegin = true;
-
-				synchronized (conn) {
-					prepareGetStrtDataLocStmt(conn);
-					GetStrtDataLoc_.setLong(1,
-							SQLMXConnection.reserveDataLocator_);
-
-					ResultSet rs = GetStrtDataLoc_.executeQuery();
-					try {
-						if (rs.next()) {
-							startDataLocator_ = rs.getLong(1);
-
-							if ((traceWriter_ != null)
-									&& ((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL))) {
-								traceWriter_
-										.println(getTraceId()
-												+ "getStartDataLocator() - GetStrtDataLocStmt params: reserveDataLocator_="
-												+ SQLMXConnection.reserveDataLocator_
-												+ " startDataLocator_="
-												+ startDataLocator_);
-							}
-						} else {
-							insertDataLocatorRow(conn);
-						}
-					} finally {
-						rs.close();
-					}
-					tx.commit(false);
-					txBegin = false;
-				}
-				if (cref != null)
-					tx.resume(cref);
-			}
-			catch (com.tandem.util.FSException fe1) {
-				SQLException se1 = null;
-				SQLException se2;
-
-				try {
-					if (txBegin)
-						tx.rollback();
-					if (cref != null)
-						tx.resume(cref);
-				} catch (com.tandem.util.FSException fe2) {
-					Object[] messageArguments = new Object[2];
-					messageArguments[0] = Short.toString(fe2.error);
-					messageArguments[1] = fe2.getMessage();
-					se1 = Messages.createSQLException(conn.locale_,
-							"transaction_error", messageArguments);
-				}
-				Object[] messageArguments = new Object[2];
-				messageArguments[0] = Short.toString(fe1.error);
-				messageArguments[1] = fe1.getMessage();
-				se2 = Messages.createSQLException(conn.locale_,
-						"transaction_error", messageArguments);
-				if (se1 != null)
-					se2.setNextException(se1);
-				throw se2;
-			}
-			catch (SQLException se) {
-				SQLException se1 = null;
-				try {
-					if (txBegin)
-						tx.rollback();
-					if (cref != null)
-						tx.resume(cref);
-				}
-				catch (com.tandem.util.FSException fe2) {
-					Object[] messageArguments = new Object[2];
-					messageArguments[0] = Short.toString(fe2.error);
-					messageArguments[1] = fe2.getMessage();
-					se1 = Messages.createSQLException(conn.locale_,
-							"transaction_error", messageArguments);
-				}
-				if (se1 != null)
-					se.setNextException(se1);
-				throw se;
-			} finally {
-				conn.setTxid_(currentTxid);
-			}
-			return startDataLocator_;
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_getStartDataLocator].methodExit();
-		}
-*/
-		return 0;	// Linux port - Temp added
-	}
-
-	void insertDataLocatorRow(SQLMXConnection conn) throws SQLException {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_insertDataLocatorRow].methodEntry();
-		try {
-			String lobInsDataLocRowSQL;
-
-			if (prepareInsert_) {
-				String lobGetMaxDataLocSQL = "select max(data_locator) from "
-						+ lobTableName_;
-				GetMaxDataLoc_ = conn.prepareLobStatement(lobGetMaxDataLocSQL);
-			}
-
-			ResultSet rs = GetMaxDataLoc_.executeQuery();
-			try {
-				if (rs.next()) {
-					startDataLocator_ = rs.getLong(1) + 1;
-
-					if ((traceWriter_ != null)
-							&& ((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL))) {
-						traceWriter_
-								.println(getTraceId()
-										+ "insertDataLocatorRow() - Retrieved startDataLocator_="
-										+ startDataLocator_ + " from "
-										+ lobTableName_);
-					}
-				}
-			} finally {
-				rs.close();
-			}
-
-			long dataLocVal = startDataLocator_
-					+ SQLMXConnection.reserveDataLocator_ - 1;
-
-			if ((traceWriter_ != null)
-					&& ((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL))) {
-				traceWriter_.println(getTraceId()
-						+ "insertDataLocatorRow() - dataLocVal=" + dataLocVal
-						+ " startDataLocator_=" + startDataLocator_
-						+ " lobCharSet_=" + lobCharSet_ + " prepareInsert_="
-						+ prepareInsert_ + " prepDataLocVal_="
-						+ prepDataLocVal_);
-			}
-
-			// Re-prepare special LOB table row if lobTableName_ has changed
-			// (prepareInsert_ flag)
-			// or if the data locator value has changed from previous statement
-			// prepare.
-			if (prepareInsert_ || (dataLocVal != prepDataLocVal_)) {
-				if (lobCharSet_.equals(SQLMXConnection.UCS_STR)) // Unicode data
-				{
-					lobInsDataLocRowSQL = "insert into "
-							+ lobTableName_
-							+ " (table_name, data_locator, chunk_no, lob_data) values ('ZZDATA_LOCATOR', 0, 0, cast("
-							+ dataLocVal
-							+ " as VARCHAR(100) character set UCS2))";
-				} else // ISO data
-				{
-					lobInsDataLocRowSQL = "insert into "
-							+ lobTableName_
-							+ " (table_name, data_locator, chunk_no, lob_data) values ('ZZDATA_LOCATOR', 0, 0, cast("
-							+ dataLocVal + " as VARCHAR(100)))";
-				}
-				InsDataLocRow_ = conn.prepareLobStatement(lobInsDataLocRowSQL);
-				prepDataLocVal_ = dataLocVal;
-				prepareInsert_ = false;
-			}
-
-			InsDataLocRow_.executeUpdate();
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_insertDataLocatorRow].methodExit();
-		}
-	}
-
-	void prepareGetStrtDataLocStmt(SQLMXConnection conn) throws SQLException {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_prepareGetStrtDataLocStmt].methodEntry();
-		try {
-			/*
-			 * Description: JDBC no longer throws
-			 * "Connection does not exist" for an active connection.
-			 */
-			if (conn.prepareGetStrtDataLocStmt(lobTableName_, isBlob_,
-					lobCharSet_)
-					|| (GetStrtDataLoc_.getConnection() != conn)) {
-				if (isBlob_) {
-					GetStrtDataLoc_ = conn.LobPrepStmts[SQLMXConnection.BLOB_GET_STRT_DATA_LOC_STMT];
-				} else {
-					GetStrtDataLoc_ = conn.LobPrepStmts[SQLMXConnection.CLOB_GET_STRT_DATA_LOC_STMT];
-				}
-				// Set flag to re-prepare next two LOB statements in the path
-				// (GetMaxDataLoc_ and InsDataLocRow_)
-				prepareInsert_ = true;
-			}
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_prepareGetStrtDataLocStmt].methodExit();
-		}
-	}
-
-	SQLMXDataLocator(SQLMXConnection conn, String lobTableName)
-			throws SQLException {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_SQLMXDataLocator].methodEntry();
-		try {
-
-
-			lobTableName_ = lobTableName;
-			// Obtain the precision of the lob_data column to set the
-			// appropriate
-			// chunk size for LOB data operations.
-			String s = "select lob_data from " + lobTableName
-					+ " where table_name = 'ZZDATA_LOCATOR' ";
-			PreparedStatement ps = conn.prepareLobStatement(s);
-			ResultSetMetaData rsmd = ps.getMetaData();
-			lobCharSet_ = ((SQLMXResultSetMetaData) rsmd).cpqGetCharacterSet(1);
-
-			// Set appropriate chunkSize_ based on character set type
-			if (lobCharSet_.equals(SQLMXConnection.UCS_STR)) {
-				chunkSize_ = (rsmd.getPrecision(1)) / 2;
-			} else {
-				chunkSize_ = rsmd.getPrecision(1);
-			}
-
-			if ((traceWriter_ != null)
-					&& ((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL))) {
-				traceWriter_.println(getTraceId()
-						+ "SQLMXDataLocator() - constructor chunkSize_="
-						+ chunkSize_ + " lobTableName=" + lobTableName);
-			}
-
-			ps.close();
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_SQLMXDataLocator].methodExit();
-		}
-	}
-	public void setTraceId(String traceId_) {
-		this.traceId_ = traceId_;
-	}
-
-	public String getTraceId() {
-		traceWriter_ = SQLMXDataSource.traceWriter_;
-
-		// Build up template portion of jdbcTrace output. Pre-appended to
-		// jdbcTrace entries.
-		// jdbcTrace:[XXXX]:[Thread[X,X,X]]:[XXXXXXXX]:ClassName.
-		if (traceWriter_ != null) {
-			traceFlag_ = T2Driver.traceFlag_;
-			String className = getClass().getName();
-			setTraceId(T2Driver.traceText
-					+ T2Driver.dateFormat.format(new Date())
-					+ "]:["
-					+ Thread.currentThread()
-					+ "]:["
-					+ hashCode()
-					+ "]:"
-					+ className.substring(T2Driver.REMOVE_PKG_NAME,
-							className.length()) + ".");
-		}
-		return traceId_;
-	}
-
-	// Fields
-	private String traceId_;
-	static PrintWriter traceWriter_;
-	static int traceFlag_;
-	String lobTableName_;
-	String lobCharSet_;
-	long startDataLocator_;
-	long currentDataLocator_;
-	int chunkSize_;
-	long prepDataLocVal_;
-	boolean isBlob_;
-	boolean prepareInsert_ = false;
-
-	PreparedStatement GetStrtDataLoc_;
-	PreparedStatement GetMaxDataLoc_;
-	PreparedStatement InsDataLocRow_;
-
-	private static int methodId_getDataLocator = 0;
-	private static int methodId_getStartDataLocator = 1;
-	private static int methodId_insertDataLocatorRow = 2;
-	private static int methodId_prepareGetStrtDataLocStmt = 3;
-	private static int methodId_SQLMXDataLocator = 4;
-	private static int totalMethodIds = 5;
-	private static JdbcDebug[] debug;
-
-	static {
-		String className = "SQLMXDataLocator";
-		if (JdbcDebugCfg.entryActive) {
-			debug = new JdbcDebug[totalMethodIds];
-			debug[methodId_getDataLocator] = new JdbcDebug(className,
-					"getDataLocator");
-			debug[methodId_getStartDataLocator] = new JdbcDebug(className,
-					"getStartDataLocator");
-			debug[methodId_insertDataLocatorRow] = new JdbcDebug(className,
-					"insertDataLocatorRow");
-			debug[methodId_prepareGetStrtDataLocStmt] = new JdbcDebug(
-					className, "prepareGetStrtDataLocStmt");
-			debug[methodId_SQLMXDataLocator] = new JdbcDebug(className,
-					"SQLMXDataLocator");
-		}
-	}
-}
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDataSource.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDataSource.java
index 0579079..1233f3a 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDataSource.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDataSource.java
@@ -194,7 +194,7 @@
 //					mxConnect = new SQLMXConnection(this,getDataSourceProperties());
 					mxConnect = new SQLMXConnection(this,getT2Properties());
 					weakConnection.refToDialogueId_.put(mxConnect.pRef_, new Long(mxConnect
-							.getDialogueId_()));
+							.getDialogueId()));
 				} else {
 
 					int maxSt = getMaxStatements();
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDatabaseMetaData.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDatabaseMetaData.java
index 7741794..1f041a2 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDatabaseMetaData.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDatabaseMetaData.java
@@ -51,7 +51,7 @@
  * 
  */
 /*
- * Methods Changed: getTxid_() changes 
+ * Methods Changed: getTxid() changes 
  */
 
 public class SQLMXDatabaseMetaData extends SQLMXHandle implements
@@ -2528,7 +2528,7 @@
 				else
 					schemaNm = schemaPattern;
 				resultSet = getProcedures(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, procedureNamePattern);
 			}// End sync
@@ -2634,7 +2634,7 @@
 				else
 					schemaNm = schemaPattern;
 				resultSet = getProcedureColumns(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, procedureNamePattern,
 						columnNamePattern);
@@ -2749,7 +2749,7 @@
 				} else
 					tableTypeList = null;
 				resultSet = getTables(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, tableNm, tableTypeList);
 			}// End sync
@@ -2792,7 +2792,7 @@
 					throw Messages.createSQLException(connection_.locale_,
 							"invalid_connection", null);
 				resultSet = getSchemas(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						"%");
 			}// End sync
@@ -2834,7 +2834,7 @@
 					throw Messages.createSQLException(connection_.locale_,
 							"invalid_connection", null);
 				resultSet = getCatalogs(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						"%");
 			}// End sync
@@ -2882,7 +2882,7 @@
 					null, 100, 0, 0, null);
 
 			resultSet = new SQLMXResultSet(this, outputDesc, connection_
-					.getTxid_(), 0);
+					.getTxid(), 0);
 			rows = new DataWrapper[3];
 
 			// Populate the rows
@@ -2895,7 +2895,7 @@
 			rows[2] = new DataWrapper(1);
 			rows[2].setString(1, new String("VIEW"));
 
-			resultSet.setFetchOutputs(rows, 3, true, connection_.getTxid_());
+			resultSet.setFetchOutputs(rows, 3, true, connection_.getTxid());
 			return resultSet;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -3008,7 +3008,7 @@
 					columnNm = columnNamePattern;
 
 				resultSet = getColumns(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, tableNm, columnNm);
 			}// End sync
@@ -3092,7 +3092,7 @@
 					schemaNm = schema;
 
 				resultSet = getColumnPrivileges(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table, columnNamePattern);
 			}// End sync
@@ -3172,7 +3172,7 @@
 					schemaNm = schema;
 
 				resultSet = getTablePrivileges(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table);
 			}// End sync
@@ -3261,7 +3261,7 @@
 				else
 					schemaNm = schema;
 				resultSet = getBestRowIdentifier(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table, scope, nullable);
 			}// End sync
@@ -3338,7 +3338,7 @@
 				else
 					schemaNm = schema;
 				resultSet = getVersionColumns(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table);
 			}// End sync
@@ -3406,7 +3406,7 @@
 				else
 					schemaNm = schema;
 				resultSet = getPrimaryKeys(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table);
 			}// End sync
@@ -3519,7 +3519,7 @@
 					schemaNm = schema;
 
 				resultSet = getImportedKeys(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table);
 			}// End sync
@@ -3633,7 +3633,7 @@
 					schemaNm = schema;
 
 				resultSet = getExportedKeys(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table);
 			}// End sync
@@ -3770,7 +3770,7 @@
 					foreignSchemaNm = foreignSchema;
 
 				resultSet = getCrossReference(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						primaryCatalogNm, primarySchemaNm, primaryTable,
 						foreignCatalogNm, foreignSchemaNm, foreignTable);
@@ -3847,7 +3847,7 @@
 					throw Messages.createSQLException(connection_.locale_,
 							"invalid_connection", null);
 				resultSet = getTypeInfo(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_);
 			}// End sync
 			// Patch the column names as per JDBC specification
@@ -3952,7 +3952,7 @@
 				else
 					schemaNm = schema;
 				resultSet = getIndexInfo(connection_.server_,
-						connection_.getDialogueId_(), connection_.getTxid_(),
+						connection_.getDialogueId(), connection_.getTxid(),
 						connection_.autoCommit_, connection_.transactionMode_,
 						catalogNm, schemaNm, table, unique, approximate);
 			}// End sync
@@ -4108,11 +4108,11 @@
 					null, 130, 0, 0, null);
 
 			resultSet = new SQLMXResultSet(this, outputDesc, connection_
-					.getTxid_(), 0);
+					.getTxid(), 0);
 			rows = new DataWrapper[0];
 
 			// Populate the rows
-			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid_());
+			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid());
 			return resultSet;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -4556,11 +4556,11 @@
 					(short) 0, 0, null, null, null, 100, 0, 0, null);
 
 			resultSet = new SQLMXResultSet(this, outputDesc, connection_
-					.getTxid_(), 0);
+					.getTxid(), 0);
 			rows = new DataWrapper[0];
 
 			// Populate the rows
-			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid_());
+			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid());
 			return resultSet;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -4644,11 +4644,11 @@
 					(short) 0, 0, null, null, null, 100, 0, 0, null);
 
 			resultSet = new SQLMXResultSet(this, outputDesc, connection_
-					.getTxid_(), 0);
+					.getTxid(), 0);
 			rows = new DataWrapper[0];
 
 			// Populate the rows
-			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid_());
+			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid());
 			return resultSet;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -4833,11 +4833,11 @@
 					(short) 0, 0, null, null, null, 130, 0, 0, null);
 
 			resultSet = new SQLMXResultSet(this, outputDesc, connection_
-					.getTxid_(), 0);
+					.getTxid(), 0);
 			rows = new DataWrapper[0];
 
 			// Populate the rows
-			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid_());
+			resultSet.setFetchOutputs(rows, 0, true, connection_.getTxid());
 			return resultSet;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLob.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLob.java
index f48c3ba..da11fda 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLob.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLob.java
@@ -31,122 +31,27 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.IOException;
-//import com.tandem.tmf.Current;	// Linux port - ToDo
 import java.util.Date;
 import java.io.PrintWriter;
 
 public abstract class SQLMXLob
 {
-	// public methods
+        long inLength() throws SQLException 
+        {
+		if (b_ != null && length_ == 0)
+			return b_.length;
+		else
+			return length_;
+        }
+
 	public long length() throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_length].methodEntry();
-		try
-		{
-			long length = 0;
-
-			checkIfCurrent();
-			prepareGetLobLenStmt();
-			PreparedStatement GetLobLenStmt = getGetLobLenStmt();
-
-			if ((traceWriter_ != null) &&
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId()
-					+ "length() - GetLobLenStmt params: tableName_=" + tableName_
-					+ " dataLocator_=" + dataLocator_);
-			}
-
-			synchronized (GetLobLenStmt)
-			{
-				GetLobLenStmt.setString(1, tableName_);
-				GetLobLenStmt.setLong(2, dataLocator_);
-				ResultSet rs = GetLobLenStmt.executeQuery();
-				try
-				{
-					if (rs.next())
-						length = rs.getLong(1);
-				}
-				finally
-				{
-					rs.close();
-				}
-			}
-			return length;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_length].methodExit();
-		}
+		throw new SQLFeatureNotSupportedException("Clob or Blob.length() is not supported");
 	}
 
 	public void truncate(long len) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_truncate].methodEntry();
-		try
-		{
-			int chunkNo;
-			int offset;
-			byte[] chunk;
-
-			if (len < 0)
-			{
-				Object[] messageArguments = new Object[1];
-				messageArguments[0] = "SQLMXLob.truncate(long)";
-				throw Messages.createSQLException(conn_.locale_,"invalid_input_value", messageArguments);
-			}
-			checkIfCurrent();
-			chunkNo = (int)(len / chunkSize_);
-			offset = (int)(len % chunkSize_);
-			prepareDelLobDataStmt();
-			PreparedStatement DelLobStmt = getDelLobDataStmt();
-
-			if ((traceWriter_ != null) &&
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId()
-					+ "truncate(" + len + ") - DelLobStmt params: tableName_=" + tableName_
-					+ " dataLocator_=" + dataLocator_
-					+ " chunkNo+1=" + chunkNo+1);
-			}
-
-			synchronized (DelLobStmt)
-			{
-				DelLobStmt.setString(1, tableName_);
-				DelLobStmt.setLong(2, dataLocator_);
-				DelLobStmt.setInt(3, chunkNo+1);
-				DelLobStmt.setInt(4, Integer.MAX_VALUE);
-				DelLobStmt.executeUpdate();
-			}
-			if (offset != 0)
-			{
-				prepareTrunLobDataStmt();
-				PreparedStatement TrunLobStmt = getTrunLobDataStmt();
-
-				if ((traceWriter_ != null) &&
-					((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-				{
-					traceWriter_.println(getTraceId()
-						+ "truncate(" + len + ") - TrunLobStmt params: offset=" + offset
-						+ " tableName_=" + tableName_
-						+ " dataLocator_=" + dataLocator_
-						+ " chunkNo=" + chunkNo);
-				}
-
-				synchronized (TrunLobStmt)
-				{
-					TrunLobStmt.setInt(1, offset);
-					TrunLobStmt.setString(2, tableName_);
-					TrunLobStmt.setLong(3, dataLocator_);
-					TrunLobStmt.setInt(4, chunkNo);
-					TrunLobStmt.executeUpdate();
-				}
-			}
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_truncate].methodExit();
-		}
+		throw new SQLFeatureNotSupportedException("Clob or Blob.truncate(long) is not supported");
 	}
 
 	InputStream getInputStream() throws SQLException
@@ -178,60 +83,21 @@
 		}
 	}
 
-	OutputStream setOutputStream(long pos) throws SQLException
+	SQLMXLobOutputStream setOutputStream(long startingPos) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_setOutputStream].methodEntry();
-		try
-		{
-			if (outputStream_ != null)
-			{
-				try
-				{
-					outputStream_.close();
-				}
-				catch (IOException e)
-				{
-				}
-				finally
-				{
-					outputStream_ = null;
-				}
-			}
-			outputStream_ = new SQLMXLobOutputStream(conn_, this, pos);
-			return outputStream_;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_setOutputStream].methodExit();
-		}
+		outputStream_ = new SQLMXLobOutputStream(conn_, startingPos, this);
+		return outputStream_;
 	}
 
 
-	void close()
+	void close() throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_close].methodEntry();
-		try
-		{
+		try {
+			if (inputStream_ != null)
+				inputStream_.close();
 			isCurrent_ = false;
-			try
-			{
-				if (inputStream_ != null)
-					inputStream_.close();
-				if (outputStream_ != null)
-					outputStream_.close();
-			}
-			catch (IOException e)
-			{
-			}
-			finally
-			{
-				inputStream_ = null;
-				outputStream_ = null;
-			}
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_close].methodExit();
+		} catch (IOException ioe) {
+			throw new SQLException(ioe);
 		}
 	}
 
@@ -262,7 +128,7 @@
 		}
 	}
 
-	void checkIfCurrent() throws SQLException
+        void checkIfCurrent() throws SQLException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_checkIfCurrent].methodEntry();
 		try
@@ -281,112 +147,28 @@
 		}
 	}
 
-// *******************************************************************
-// * If Autocommit is enabled, and no external transaction exists, an
-// * exception will be thrown. In this case, JDBC cannot play the role of
-// * Autocommit (updating the base and lob tables in a single unit of work)
-// * because we return an OutputStream or Writer object to the application,
-// * who could hold it indefinitely. This is the case for
-// * Clob.setAsciiStream, Clob.setCharacterStream, and Blob.setBinaryStream.
-// *******************************************************************
-	void checkAutoCommitExtTxn() throws SQLException
+	void setLobLocator(String lobLocator)
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_checkAutoCommitExtTxn].methodEntry();
-		try
-		{
-/* Linux port - ToDo com.tandem.util.FSException in tmf.jar
-			Current tx = null;
-			int txnState = -1;
-
-			try
-			{
-				tx = new Current();
-				txnState = tx.get_status();
-
-				if (conn_.autoCommit_ && (txnState == tx.StatusNoTransaction))
-				{
-					throw Messages.createSQLException(conn_.locale_,"invalid_lob_commit_state", null);
-				}
-			}
-			catch (com.tandem.util.FSException fe1)
-			{
-				Object[] messageArguments = new Object[2];
-				messageArguments[0] = Short.toString(fe1.error);
-				messageArguments[1] = fe1.getMessage();
-				throw Messages.createSQLException(conn_.locale_, "transaction_error_update",
-					messageArguments);
-			}
-*/
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_checkAutoCommitExtTxn].methodExit();
-		}
+		lobLocator_ = lobLocator;
 	}
 
-    // Declare the following abstract methods to resolve symbols
-	abstract void prepareGetLobLenStmt() throws SQLException;
-	abstract void prepareDelLobDataStmt()  throws SQLException;
-	abstract void prepareGetLobDataStmt() throws SQLException;
-	abstract void prepareUpdLobDataStmt() throws SQLException;
-	abstract void prepareInsLobDataStmt() throws SQLException;
-	abstract void prepareTrunLobDataStmt() throws SQLException;
-	abstract PreparedStatement getGetLobLenStmt();
-	abstract PreparedStatement getDelLobDataStmt();
-	abstract PreparedStatement getTrunLobDataStmt();
-	abstract PreparedStatement getInsLobDataStmt();
-	abstract PreparedStatement getUpdLobDataStmt();
-	abstract PreparedStatement getGetLobDataStmt();
-
-
-
-	// Constructors
-	SQLMXLob(SQLMXConnection connection, String tableName, long dataLocator, String lobTableName, boolean isBlob)
-		throws SQLException
+	SQLMXLob(SQLMXConnection connection, String lobLocator, boolean isBlob) throws SQLException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXLob_LLJL].methodEntry();
-		try
-		{
-			conn_ = connection;
-			tableName_ = tableName;
-			isCurrent_ = true;
-			dataLocator_ = dataLocator;
-			if (lobTableName != null)
-			{
-				lobTableName_ = lobTableName;
-				SQLMXDataLocator tempLoc = (SQLMXDataLocator)SQLMXConnection.lobTableToDataLoc_.get(lobTableName);
-				if (tempLoc == null)
-				{
-					dataLocator = conn_.getDataLocator(lobTableName_, isBlob);
-				}
-				SQLMXDataLocator dataLoc = (SQLMXDataLocator)SQLMXConnection.lobTableToDataLoc_.get(lobTableName);
-				chunkSize_ = dataLoc.chunkSize_;
-			}
-
-
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXLob_LLJL].methodExit();
-		}
+		lobLocator_ = lobLocator;
+		conn_ = connection;
+		isBlob_ = isBlob;
+		chunkSize_ = 16*1024;
+		isCurrent_ = true;
 	}
 
-	SQLMXLob(SQLMXConnection connection, String tableName, long dataLocator, InputStream x,
-		int length, String lobTableName, boolean isBlob) throws SQLException
+	SQLMXLob(SQLMXConnection connection, String lobLocator, InputStream x, long length, boolean isBlob) throws SQLException
 	{
-		this(connection, tableName, dataLocator, lobTableName, isBlob);
-
-		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXLob_LLJLIL].methodEntry();
-		try
-		{
-			is_ = x;
-			isLength_ = length;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXLob_LLJLIL].methodExit();
-		}
+		this(connection, lobLocator, isBlob);
+		is_ = x;
+		length_ = length;
+		isCurrent_ = true;
 	}
+
 	public void setTraceId(String traceId_) {
 		this.traceId_ = traceId_;
 	}
@@ -408,31 +190,32 @@
 		return traceId_;
 	}
 	// fields
-	private String					traceId_;
+	private String			traceId_;
 	static PrintWriter		traceWriter_;
-	static int				traceFlag_;
+	static int			traceFlag_;
 	SQLMXConnection			conn_;
-	String					tableName_;
-	long					dataLocator_;
+	String				lobLocator_;
 	SQLMXLobInputStream		inputStream_;
-	SQLMXLobOutputStream	outputStream_;
-	boolean					isCurrent_;
-	InputStream				is_;
-	int						isLength_;
-	String					lobTableName_;
-	int						chunkSize_;
+	SQLMXLobOutputStream		outputStream_;
+	boolean				isCurrent_;
+	InputStream			is_;
+	byte[]				b_;
+	long				length_;
+	int				offset_;
+	int				chunkSize_;
+	boolean				isBlob_;
 
-	private static int methodId_length					=  0;
+	
+	private static int methodId_length				=  0;
 	private static int methodId_truncate				=  1;
 	private static int methodId_getInputStream			=  2;
 	private static int methodId_setOutputStream			=  3;
-	private static int methodId_close					=  4;
-	private static int methodId_convSQLExceptionToIO	=  5;
+	private static int methodId_close				=  4;
+	private static int methodId_convSQLExceptionToIO		=  5;
 	private static int methodId_checkIfCurrent			=  6;
-	private static int methodId_checkAutoCommitExtTxn	=  7;
-	private static int methodId_SQLMXLob_LLJL			=  8;
-	private static int methodId_SQLMXLob_LLJLIL			=  9;
-	private static int totalMethodIds					= 10;
+	private static int methodId_SQLMXLob_LLJL			=  7;
+	private static int methodId_SQLMXLob_LLJLIL			=  8;
+	private static int totalMethodIds				=  9;
 	private static JdbcDebug[] debug;
 
 	static
@@ -448,7 +231,6 @@
 			debug[methodId_close] = new JdbcDebug(className,"close");
 			debug[methodId_convSQLExceptionToIO] = new JdbcDebug(className,"convSQLExceptionToIO");
 			debug[methodId_checkIfCurrent] = new JdbcDebug(className,"checkIfCurrent");
-			debug[methodId_checkAutoCommitExtTxn] = new JdbcDebug(className,"checkAutoCommitExtTxn");
 			debug[methodId_SQLMXLob_LLJL] = new JdbcDebug(className,"SQLMXLob[LLJL]");
 			debug[methodId_SQLMXLob_LLJLIL] = new JdbcDebug(className,"SQLMXLob[LLJLIL]");
 		}
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobInputStream.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobInputStream.java
index f4cf5e4..57a7f11 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobInputStream.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobInputStream.java
@@ -35,72 +35,36 @@
 import java.io.IOException;
 import java.util.Date;
 import java.io.PrintWriter;
+import java.nio.ByteBuffer;
 
 public class SQLMXLobInputStream extends InputStream
 {
 	public int available() throws IOException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_available].methodEntry();
-		try
-		{
-			long length;
-			long readLength;
+		int remainLen;
 
-			if (isClosed_)
-				throw new IOException("Input stream is in closed state");
-			try
-			{
-				length = lob_.length();
-				if (currentChunkNo_ > 0)
-					readLength = ((currentChunkNo_-1) * lob_.chunkSize_) + currentByte_;
-				else
-					readLength = currentByte_;
-				return (int)(length - readLength);
-			}
-			catch (SQLException e)
-			{
-				throw new IOException(SQLMXLob.convSQLExceptionToIO(e));
-			}
+		if (eos_)
+			remainLen = 0;
+		else {
+			remainLen = bytesRead_ - currentPos_;
+			if (remainLen == 0) // 0 would mean all the bytes are read from chunk_
+				remainLen = lob_.chunkSize_;
 		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_available].methodExit();
-		}
+		return remainLen;
 	}
 
 	public void close() throws IOException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_close].methodEntry();
-		try
-		{
-			isClosed_ = true;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_close].methodExit();
-		}
+		isClosed_ = true;
 	}
 
 	public void mark(int readlimit)
 	{
-		if (JdbcDebugCfg.entryActive)
-		{
-			debug[methodId_mark].methodEntry();
-			debug[methodId_mark].methodExit();
-		}
 	}
 
 	public boolean markSupported()
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_markSupported].methodEntry();
-		try
-		{
-			return false;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_markSupported].methodExit();
-		}
+		return false;
 	}
 
 	public int read() throws IOException
@@ -110,19 +74,14 @@
 		{
 			int retValue = 0;
 
-			if (isClosed_)
-				throw new IOException("Input stream is in closed state");
-			if (currentByte_ == bytesRead_)
-				retValue = readChunkThrowIO(null, 0, lob_.chunkSize_);
+			if (eos_)
+				return -1;
+			if (currentPos_ == bytesRead_)
+				retValue = readChunkThrowIO();
 			if (retValue != -1)
 			{
-				retValue = chunk_[currentByte_];
-				// Should be a value between 0 and 255 
-				// -1 is mapped to 255, -2 is 254 etc
-				if (retValue < 0)
-					retValue = 256 + retValue; 
-				if (currentByte_ != bytesRead_)
-					currentByte_++;
+				retValue = chunk_.get();
+				currentPos_++;
 			}
 			return retValue;
 		}
@@ -134,65 +93,58 @@
 
 	public int read(byte[] b) throws IOException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_read_B].methodEntry();
-		try
-		{
-			if (b == null)
-				throw new IOException("Invalid input value");
-			return read(b, 0, b.length);
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_read_B].methodExit();
-		}
+		return read(b, 0, b.length);
 	}
 
 	public int read(byte[] b, int off, int len) throws IOException
 	{
+		return read(b, off, len, false);
+	}
+
+	public int read(byte[] b, int off, int len, boolean skip) throws IOException
+	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_read_BII].methodEntry();
 		try
 		{
-			int readLen;
+			int remainLen;
 			int copyLen;
 			int copyOffset;
-			int tempLen = 0;
 			int retLen;
+			int availableLen;
+			int copiedLen = 0;
 
-			if (isClosed_)
-				throw new IOException("Input stream is in closed state");
 			if (b == null)
 				throw new IOException("Invalid input value");
-			copyLen = len;
+			if (eos_)
+				return -1;		
+			remainLen = len;
 			copyOffset = off;
-			readLen = 0;
-			if (currentByte_ < bytesRead_)
-			{
-				if (copyLen+currentByte_ <= bytesRead_)
-				{
-					System.arraycopy(chunk_, currentByte_, b, copyOffset, copyLen);
-					currentByte_ += copyLen;
-					readLen = copyLen;
-					return readLen;
-				}
+			
+			while (remainLen > 0) {
+				availableLen = bytesRead_ - currentPos_;
+				if (availableLen > remainLen)	
+					copyLen = remainLen;
 				else
-				{
-					tempLen = bytesRead_- currentByte_;
-					System.arraycopy(chunk_, currentByte_, b, copyOffset, tempLen);
-					copyOffset += tempLen;
-					copyLen -= tempLen;
-					currentByte_ += tempLen;
+					copyLen = availableLen;
+				if (copyLen > 0) {
+					if (! skip)
+						chunk_.get(b, copyOffset, copyLen);			
+					else
+						chunk_.position(currentPos_+copyLen);
+					currentPos_ += copyLen;
+					copyOffset += copyLen;
+					copiedLen += copyLen;
+					remainLen -= copyLen;
+		
+				}
+				if (remainLen > 0) {
+					retLen = readChunkThrowIO();
+					if (retLen == -1)
+						break;
 				}
 			}
-			readLen = readChunkThrowIO(b, copyOffset, copyLen);
-			if (readLen != -1)
-				retLen = readLen + tempLen;
-			else
-				retLen = tempLen;
-			if (retLen == 0)
-				return -1;
-			else
-				return retLen;
-		}
+			return copiedLen;
+		}		
 		finally
 		{
 			if (JdbcDebugCfg.entryActive) debug[methodId_read_BII].methodExit();
@@ -204,10 +156,7 @@
 		if (JdbcDebugCfg.entryActive) debug[methodId_reset].methodEntry();
 		try
 		{
-			if (isClosed_)
-				throw new IOException("Input stream is in closed state");
-			currentByte_ = 0;
-			currentChunkNo_ = 0;
+			currentPos_ = 0;
 			bytesRead_ = 0;
 			return;
 		}
@@ -219,87 +168,34 @@
 
 	public long skip(long n) throws IOException
 	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_skip].methodEntry();
-		try
-		{
-			long bytesToSkip;
-			int noOfChunks = 0;
-			int remBytes;
-			long retLen = -1;
-			long bytesSkipped = 0;
-			int oldChunkNo;
-
-			if (isClosed_)
-				throw new IOException("Input stream is in closed state");
-			if (n <= 0)
-				throw new IOException("Invalid input Value");
-			if (currentByte_ + n > bytesRead_)
-			{
-				bytesSkipped = bytesRead_ - currentByte_;
-				bytesToSkip = n - bytesSkipped;
-				currentByte_ += bytesSkipped;
-			}
+		long totalSkippedLen = 0;
+		long skipRemain = n;
+		int skipLen;
+		int skippedLen;
+		while (skipRemain > 0) {
+			if (skipRemain <= Integer.MAX_VALUE)
+				skipLen = (int)skipRemain;
 			else
-			{
-				currentByte_ += n;
-				return n;
-			}
-			noOfChunks += (int)((bytesToSkip-1)/ lob_.chunkSize_);
-			if ((bytesToSkip % lob_.chunkSize_) == 0)
-				remBytes = lob_.chunkSize_;
-			else
-				remBytes = (int)(bytesToSkip % lob_.chunkSize_);
-			oldChunkNo = currentChunkNo_;	// Which is already 1 more
-			currentChunkNo_ = currentChunkNo_ + noOfChunks;
-			retLen = readChunkThrowIO(null, 0, lob_.chunkSize_);
-			if (retLen != -1)
-			{
-				bytesSkipped += (currentChunkNo_ - oldChunkNo - 1) * lob_.chunkSize_;
-				if (retLen < remBytes)
-					remBytes = (int)retLen;
-				currentByte_ = remBytes;
-				bytesSkipped += remBytes;
-			}
-			else
-			{
-				bytesSkipped += available();
-				// Exclude the bytes that are in chunk already
-				remBytes = (int)(bytesSkipped - (bytesRead_ - currentByte_));
-				noOfChunks += (int)((remBytes-1) / lob_.chunkSize_);
-				currentChunkNo_ = oldChunkNo + noOfChunks;
-				//calculate the bytes in the chunk and set currentByte and bytesRead
-				//to reach EOD
-				if (remBytes == 0)
-				{
-					currentByte_ = 0;
-					bytesRead_ = 0;
-				}
-				else
-				{
-					if ((remBytes % lob_.chunkSize_) == 0)
-						currentByte_ = lob_.chunkSize_;
-					else
-						currentByte_ = (int)(remBytes % lob_.chunkSize_);
-					bytesRead_ = currentByte_;
-				}
-			}
-			return bytesSkipped;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_skip].methodExit();
-		}
+				skipLen = Integer.MAX_VALUE;	
+			skippedLen = read(null, 0, skipLen, true); 
+			if (skippedLen == -1)
+				break;
+			skipRemain -= skippedLen;
+			totalSkippedLen += skippedLen;
+		}	
+		return totalSkippedLen;
 	}
 
-	int readChunkThrowIO(byte[] b, int off, int len) throws IOException
+	int readChunkThrowIO() throws IOException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_readChunkThrowIO].methodEntry();
 		try
 		{
 			int readLen;
+
 			try
 			{
-				readLen = readChunk(b, off, len);
+				readLen = readChunk();
 			}
 			catch (SQLException e)
 			{
@@ -311,104 +207,35 @@
 		{
 			if (JdbcDebugCfg.entryActive) debug[methodId_readChunkThrowIO].methodExit();
 		}
-	} 
-
-	int readChunk(byte[] b, int off, int len) throws SQLException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_readChunk].methodEntry();
-		try
-		{
-			int endChunkNo;
-			byte[]	data;
-			int copyLen;
-			int	copyOffset;
-			int readLen = 0;
-
-			// The rows to read is calculated via ((len-1)/lob_.chunkSize_)
-			endChunkNo = currentChunkNo_ + ((len-1)/lob_.chunkSize_);
-			lob_.prepareGetLobDataStmt();
-			PreparedStatement GetLobStmt = lob_.getGetLobDataStmt();
-
-			if ((traceWriter_ != null) && 
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId() 
-					+ "readChunk(<byte>," + off + "," + len + ") - GetLobDataStmt params: tableName_=" + lob_.tableName_ 
-					+ " dataLocator_=" + lob_.dataLocator_
-					+ " currentChunkNo_=" + currentChunkNo_
-					+ " endChunkNo=" + endChunkNo);
-			}
-
-			synchronized (GetLobStmt)
-			{
-				GetLobStmt.setString(1, lob_.tableName_);
-				GetLobStmt.setLong(2, lob_.dataLocator_);
-				GetLobStmt.setInt(3, currentChunkNo_);
-				GetLobStmt.setInt(4, endChunkNo);
-				ResultSet rs = GetLobStmt.executeQuery();
-				copyLen = len;
-				copyOffset = off;
-				try 
-				{
-					while (rs.next())
-					{
-						data = rs.getBytes(1);
-						currentChunkNo_++;
-						bytesRead_ = data.length;
-						if (b == null)
-						{
-							System.arraycopy(data, 0, chunk_, 0, data.length);
-							readLen += data.length;
-							currentByte_ = 0;
-							break;				
-						}
-						else
-						{
-							if (copyLen >= data.length)
-							{
-								System.arraycopy(data, 0, b, copyOffset, data.length);
-								copyLen -= data.length;
-								readLen += data.length;
-								copyOffset += data.length;
-								currentByte_ = data.length;
-							} 
-							else
-							{
-								System.arraycopy(data, 0, b, copyOffset, copyLen);
-								// copy the rest of data to chunk
-								System.arraycopy(data, copyLen, chunk_, copyLen, data.length - copyLen);
-								readLen += copyLen;
-								currentByte_ = copyLen;
-								break;
-							}
-						}
-					}
-				} 
-				finally 
-				{
-					rs.close();
-				}
-			}
-			
-			if ((traceWriter_ != null) && 
-				((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-			{
-				traceWriter_.println(getTraceId() 
-					+ "readChunk(<byte>," + off + "," + len + ") - LOB data read: bytesRead_=" + bytesRead_ 
-					+ " readLen=" + readLen + " copyLen=" + copyLen + " currentChunkNo_=" + currentChunkNo_);
-			}
-
-			if (readLen == 0)
-				return -1;
-			else
-				return readLen;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_readChunk].methodExit();
-		}
 	}
 
+	int readChunk() throws SQLException
+	{
+		int extractMode = 1; // get the lob data
+		chunk_.clear(); 
+		if (eos_)
+			return -1;
+		if (bytesRead_ > 0 && (bytesRead_ < lob_.chunkSize_)) {
+			eos_ = true;
+			extractMode = 2; // Close the extract
+		}
+		bytesRead_ = readChunk(conn_.server_, conn_.getDialogueId(), conn_.getTxid(), extractMode, lob_.lobLocator_, chunk_); 
+		if (bytesRead_ == -1) {
+			extractMode = 2; // close the extract
+		 	readChunk(conn_.server_, conn_.getDialogueId(), conn_.getTxid(), extractMode, lob_.lobLocator_, chunk_); 
+			eos_ = true;
+			chunk_.limit(0);
+		} else if (bytesRead_ == 0) {
+			bytesRead_ = -1;
+			eos_ = true;
+			chunk_.limit(0);
+		} else
+			chunk_.limit(bytesRead_);
+		return bytesRead_;
+	}
+
+        native int readChunk(String server, long dialogueId, long txid,  int extractMode, String lobLocator, ByteBuffer buffer);
+
 	// Constructor
 	SQLMXLobInputStream(SQLMXConnection connection, SQLMXLob lob)
 	{
@@ -417,9 +244,10 @@
 		{
 			lob_ = lob;
 			conn_ = connection;
-			chunk_ = new byte[lob_.chunkSize_];
-
-			
+			chunk_ = ByteBuffer.allocateDirect(lob_.chunkSize_);
+			bytesRead_ = 0;
+			currentPos_ = 0;
+			eos_ = false;
 		}
 		finally
 		{
@@ -449,16 +277,16 @@
 	
 
 	// Fields
-	private String				traceId_;
+	private String		traceId_;
 	static PrintWriter	traceWriter_;
-	static int			traceFlag_;
-	SQLMXLob			lob_;
+	static int		traceFlag_;
+	SQLMXLob		lob_;
 	SQLMXConnection		conn_;
-	boolean				isClosed_;
-	byte[]				chunk_;
-	int					currentByte_;
-	int					currentChunkNo_;
-	int					bytesRead_;
+	boolean			isClosed_;
+	ByteBuffer		chunk_;
+	int			currentPos_;
+	int			bytesRead_;
+	boolean 		eos_;
 
 	private static int methodId_available			=  0;
 	private static int methodId_close				=  1;
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobOutputStream.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobOutputStream.java
index 64da030..fe0e3f5 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobOutputStream.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXLobOutputStream.java
@@ -63,8 +63,10 @@
 		{
 			if (isClosed_)
 				throw new IOException("Output stream is in closed state");
-			if (! isFlushed_)
-				writeChunkThrowIO();
+			if (! isFlushed_) {
+				writeChunkThrowIO(chunk_, 0, currentByte_);
+				currentByte_ = 0;
+			}
 		}
 		finally
 		{
@@ -72,6 +74,28 @@
 		}
 	}
 
+	public void write(int b) throws IOException
+	{
+		if (JdbcDebugCfg.entryActive) debug[methodId_write_I].methodEntry();
+		try
+		{
+			if (isClosed_)
+				throw new IOException("Output stream is in closed state");
+			chunk_[currentByte_] = (byte)b;
+			isFlushed_ = false;
+			currentByte_++;
+			if (currentByte_ == lob_.chunkSize_) {
+				writeChunkThrowIO(chunk_, 0, currentByte_);
+				currentByte_ = 0;
+			}
+		}
+		finally
+		{
+			if (JdbcDebugCfg.entryActive) debug[methodId_write_I].methodExit();
+		}
+	}
+
+
 	public void write(byte[] b) throws IOException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_write_B].methodEntry();
@@ -93,7 +117,7 @@
 		try
 		{
 			int copyLen;
-			int	srcOffset;
+			int srcOffset;
 			int tempLen;
 
 			if (isClosed_)
@@ -105,26 +129,26 @@
 					"length or offset is less than 0 or offset is greater than the length of array");
 			srcOffset = off;
 			copyLen = len;
-			while (true)
-			{
-				if ((copyLen+currentByte_) < lob_.chunkSize_)
-				{
+			while (true) {
+				if ((copyLen+currentByte_) < lob_.chunkSize_) {
 					System.arraycopy(b, srcOffset, chunk_, currentByte_, copyLen);
 					currentByte_ += copyLen;
 					isFlushed_ = false;
 					break;
-				}
-				else
-				{
-					tempLen = lob_.chunkSize_-currentByte_;		
-					System.arraycopy(b, srcOffset, chunk_, currentByte_, tempLen);
-					currentByte_ += tempLen;
-					writeChunkThrowIO();
+				} else {
+					if (currentByte_ != 0) {
+						tempLen = lob_.chunkSize_-currentByte_;		
+						System.arraycopy(b, srcOffset, chunk_, currentByte_, tempLen);
+						currentByte_ += tempLen;
+						writeChunkThrowIO(chunk_, 0, currentByte_);
+						currentByte_ = 0;
+					} else {
+						tempLen = lob_.chunkSize_;
+						writeChunkThrowIO(b, srcOffset, tempLen);
+					}
 					copyLen -= tempLen;
 					srcOffset += tempLen;
-					currentByte_ = 0;
 				}
-				
 			}
 		}
 		finally
@@ -132,99 +156,15 @@
 			if (JdbcDebugCfg.entryActive) debug[methodId_write_BII].methodExit();
 		}
 	}
-	
-	public void write(int b)
-		throws IOException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_write_I].methodEntry();
-		try
-		{
-			if (isClosed_)
-				throw new IOException("Output stream is in closed state");
-			chunk_[currentByte_] = (byte)b;
-			isFlushed_ = false;
-			currentByte_++;
-			if (currentByte_ == lob_.chunkSize_)
-				writeChunkThrowIO();
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_write_I].methodExit();
-		}
-	}
 
-	void writeChunk() throws SQLException
-	{
-		if (JdbcDebugCfg.entryActive) debug[methodId_writeChunk].methodEntry();
-		try
-		{
-			byte[] tempChunk;
-
-			if (currentChunkNo_ > updChunkNo_)
-			{
-				lob_.prepareInsLobDataStmt();
-				PreparedStatement InsLobStmt = lob_.getInsLobDataStmt();
-
-				synchronized (InsLobStmt)
-				{
-					InsLobStmt.setString(1, lob_.tableName_);
-					InsLobStmt.setLong(2, lob_.dataLocator_);
-					InsLobStmt.setInt(3, currentChunkNo_);
-					if (currentByte_ != lob_.chunkSize_)
-					{
-						tempChunk = new byte[currentByte_];
-						System.arraycopy(chunk_, 0, tempChunk, 0, currentByte_);
-					}
-					else
-						tempChunk = chunk_;	
-					InsLobStmt.setBytes(4, tempChunk);
-					InsLobStmt.executeUpdate();
-					currentChunkNo_++;
-					currentByte_ = 0;
-				}
-			}
-			else
-			{
-				lob_.prepareUpdLobDataStmt();
-				PreparedStatement UpdLobStmt = lob_.getUpdLobDataStmt();
-
-				synchronized (UpdLobStmt)
-				{
-					UpdLobStmt.setString(4, lob_.tableName_);
-					UpdLobStmt.setLong(5, lob_.dataLocator_);
-					UpdLobStmt.setInt(6, currentChunkNo_);
-					UpdLobStmt.setInt(1, updOffset_);
-					if (updOffset_ != 0 || currentByte_ != lob_.chunkSize_)
-					{
-						tempChunk = new byte[currentByte_-updOffset_];
-						System.arraycopy(chunk_, updOffset_, tempChunk, 0, currentByte_-updOffset_);
-					}
-					else
-						tempChunk = chunk_;	
-					UpdLobStmt.setInt(3, currentByte_+1);
-					UpdLobStmt.setBytes(2, tempChunk);
-					UpdLobStmt.executeUpdate();
-					currentChunkNo_++;
-					currentByte_ = 0;
-					updOffset_ = 0;
-				}
-			}
-			isFlushed_ = true;
-		}
-		finally
-		{
-			if (JdbcDebugCfg.entryActive) debug[methodId_writeChunk].methodExit();
-		}
-	}
-
-	void writeChunkThrowIO() throws IOException
+        void writeChunkThrowIO(byte[] chunk, int off, int len) throws IOException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_writeChunkThrowIO].methodEntry();
 		try
 		{
 			try
 			{
-				writeChunk();
+				writeChunk(chunk, off, len);
 			}
 			catch (SQLException e)
 			{
@@ -237,52 +177,37 @@
 		}
 	}
 
-	void populate(InputStream is, int length) throws SQLException
+	
+	void writeChunk(byte[] chunk, int off, int len) throws SQLException
+	{
+		writeChunk(conn_.server_, conn_.getDialogueId(), conn_.getTxid(),
+				lob_.lobLocator_, chunk, off, len, startingPos_-1+off);
+	}
+
+	void populate(InputStream is, long length) throws SQLException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_populate].methodEntry();
 		try
 		{
 			int tempLen;
-			int readLen;
+			long readLen;
 			int retLen=0;
 				
 			readLen = length;
 			try
 			{
-				while (readLen > 0)
+				while (true)
 				{
 					if (readLen <= lob_.chunkSize_)
-						tempLen = readLen;
+						tempLen = (int)readLen;
 					else
 						tempLen = lob_.chunkSize_;
 					retLen = is.read(chunk_, 0, tempLen);
-					if (retLen == -1)
+					if (retLen == -1 || (length != 0 && readLen == 0))
 						break;
-					currentByte_ = retLen;
-
-					if ((traceWriter_ != null) && 
-						((traceFlag_ == T2Driver.LOB_LVL) || (traceFlag_ == T2Driver.ENTRY_LVL)))
-					{
-						// For tracing, only print the 1st and last LOB data chunk write info to limit 
-						// potential overflow of buffer for trace output.
-						if (readLen==length) 			// 1st writeChunk
-						{
-							traceWriter_.println(getTraceId()
-								+ "populate() -  First writeChunk data: tableName_=" + lob_.tableName_
-								+ " dataLocator_=" + lob_.dataLocator_ + " length=" + length 
-								+ " currentChunkNo_=" + currentChunkNo_ + " updChunkNo_=" + updChunkNo_ + " retLen=" + retLen);
-						}
-						if (readLen<=lob_.chunkSize_)	// last writeChunk (NOTE: last chunk can be exactly chunkSize_)
-						{
-							traceWriter_.println(getTraceId()
-								+ "populate() -  Last writeChunk data: tableName_=" + lob_.tableName_
-								+ " dataLocator_=" + lob_.dataLocator_ + " length=" + length 
-								+ " currentChunkNo_=" + currentChunkNo_ + " updChunkNo_=" + updChunkNo_ + " retLen=" + retLen);
-						}
-					}
-
-					writeChunk();
-					readLen -= retLen;
+					writeChunk(chunk_, 0, retLen);
+					if (length > 0)
+						readLen -= retLen;
 				}
 			}
 			catch (IOException e)
@@ -300,7 +225,7 @@
 	}
 
 	// constructors
-	SQLMXLobOutputStream(SQLMXConnection connection, SQLMXLob lob, long pos) throws 
+	SQLMXLobOutputStream(SQLMXConnection connection, long startingPos, SQLMXLob lob) throws 
 		SQLException
 	{
 		if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXLobOutputStream].methodEntry();
@@ -309,45 +234,20 @@
 			long length;
 
 			lob_ = lob;
-			length = lob_.length();
+			length = lob_.inLength();
 			conn_ = connection;
-			if (pos < 1 || pos > length+1)
-				throw Messages.createSQLException(conn_.locale_,"invalid_position_value", null);
-			startingPos_ = pos;
 			chunk_ = new byte[lob_.chunkSize_];
 			isFlushed_ = false;
-			if (length == 0)
-				updChunkNo_ = -1;
-			else
-			{
-				if ((length % lob_.chunkSize_) == 0)
-					updChunkNo_ = (int)(length / lob_.chunkSize_)-1;
-				else
-					updChunkNo_ = (int)(length / lob_.chunkSize_);
-			}
-			currentChunkNo_ = (int)((pos-1)/ lob_.chunkSize_);
-			currentByte_ = (int)((pos-1) % lob_.chunkSize_);
-			updOffset_ = (int)((pos-1) % lob_.chunkSize_);
-
+			startingPos_ = startingPos;
 			traceWriter_ = SQLMXDataSource.traceWriter_;
-			
-			// Build up template portion of jdbcTrace output. Pre-appended to jdbcTrace entries.
-			// jdbcTrace:[XXXX]:[Thread[X,X,X]]:[XXXXXXXX]:ClassName.
-			if (traceWriter_ != null) 
-			{
-				traceFlag_ = T2Driver.traceFlag_;
-				String className = getClass().getName();
-				setTraceId(T2Driver.traceText + T2Driver.dateFormat.format(new Date()) 
-					+ "]:[" + Thread.currentThread() + "]:[" + hashCode() +  "]:" 
-					+ className.substring(T2Driver.REMOVE_PKG_NAME,className.length()) 
-					+ ".");
-			}
+			currentByte_ = 0;
 		}
 		finally
 		{
 			if (JdbcDebugCfg.entryActive) debug[methodId_SQLMXLobOutputStream].methodExit();
 		}
 	}
+
 	public void setTraceId(String traceId_) {
 		this.traceId_ = traceId_;
 	}
@@ -356,19 +256,19 @@
 		return traceId_;
 	}
 	// Fields
-	private String				traceId_;
-	static PrintWriter	traceWriter_;
+	private String			traceId_;
+	static PrintWriter		traceWriter_;
 	static int			traceFlag_;
 	SQLMXLob			lob_;
 	long				startingPos_;
-	SQLMXConnection		conn_;
+	SQLMXConnection			conn_;
 	boolean				isClosed_;
 	byte[]				chunk_;
-	int					currentByte_;
-	int					currentChunkNo_;
+	int				currentByte_;
+	int				currentChunkNo_;
 	boolean				isFlushed_;
-	int					updChunkNo_;
-	int					updOffset_;
+	int				updChunkNo_;
+	int				updOffset_;
 
 	private static int methodId_close					= 0;
 	private static int methodId_flush					= 1;
@@ -399,4 +299,5 @@
 			debug[methodId_SQLMXLobOutputStream] = new JdbcDebug(className,"SQLMXLobOutputStream");
 		}
 	}
+	native void writeChunk(String server, long dialogueId, long txid, String lobLocator, byte[] chunk, int off, int writeLength, long pos);
 }
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/SQLMXPooledConnection.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPooledConnection.java
index 6975932..8a2667a 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPooledConnection.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPooledConnection.java
@@ -215,7 +215,7 @@
 			}
 			listenerList_ = new LinkedList<ConnectionEventListener>();
 			connection_ = new SQLMXConnection(this, info);
-			refToDialogueId_.put(connection_.pRef_, new Long(connection_.getDialogueId_()));
+			refToDialogueId_.put(connection_.pRef_, new Long(connection_.getDialogueId()));
 		}
 		finally
 		{
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 e7fd377..0ede749 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
@@ -27,6 +27,7 @@
 import java.io.InputStream;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
+import java.io.IOException;
 import java.lang.ref.WeakReference;
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -53,7 +54,7 @@
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Locale;
-//import com.tandem.tmf.Current;	// Linux port - ToDo
+import java.util.Arrays;
 
 /**
  * An object that represents a precompiled SQL statement.
@@ -250,20 +251,9 @@
 			rowsValue_.add(paramContainer_);
 			paramRowCount_++;
 			paramContainer_ = new DataWrapper(inputDesc_.length);
-			if (isAnyLob_ && (lobObjects_ == null))
-				lobObjects_ = new ArrayList<Object>();
-			// Clear the isValueSet_ flag in inputDesc_ and add the lob objects
-			// to the lobObject List
+			// Clear the isValueSet_ and paramValue flag in inputDesc_ 
 			for (int i = 0; i < inputDesc_.length; i++) {
-				// If isAnyLob_ is false: inputDesc_.paramValue_ for all
-				// parameters should be null
-				// If isAnyLob_ is true: one or more inputDesc_.parmValue will
-				// not
-				// be null, based on the number of LOB columns in the query
-				if (inputDesc_[i].paramValue_ != null) {
-					lobObjects_.add(inputDesc_[i].paramValue_);
-					inputDesc_[i].paramValue_ = null;
-				}
+				inputDesc_[i].paramValue_ = null;
 				inputDesc_[i].isValueSet_ = false;
 			}
 		} finally {
@@ -302,7 +292,6 @@
 				paramContainer_.setNull(i + 1);
 				inputDesc_[i].paramValue_ = null;
 			}
-			isAnyLob_ = false;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
 				debug[methodId_clearBatch].methodExit();
@@ -337,7 +326,6 @@
 				paramContainer_.setNull(i + 1);
 				inputDesc_[i].paramValue_ = null;
 			}
-			isAnyLob_ = false;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
 				debug[methodId_clearParameters].methodExit();
@@ -366,7 +354,7 @@
 									resultSet_.close(true);
 								else{
 									close(connection_.server_,
-											connection_.getDialogueId_(), stmtId_,
+											connection_.getDialogueId(), stmtId_,
 											true);
 									connection_.hClosestmtCount++;
 
@@ -384,7 +372,7 @@
 								}
 							} else{
 								close(connection_.server_,
-										connection_.getDialogueId_(), stmtId_, true);
+										connection_.getDialogueId(), stmtId_, true);
 								connection_.hClosestmtCount++;
 
 								if (connection_.out_ != null) {
@@ -463,24 +451,12 @@
 		//**********************************************************************
 		// **
 		try {
-/* Linux port - ToDo tmf.jar related
-			Current tx = null;
-*/
-			int txnState = -1; // holds TMF transaction state code
-			boolean txBegin = false; // flag to indicate internal autocommit
 			// duties
 			boolean ret = false;
-			int currentTxid = 0;
-			// Reset current txn ID at end if internal txn used for autocommit
-			// duties
-
+			Object[] lobObjects;
 			validateExecuteInvocation();
 			try {
 				synchronized (connection_) {
-/* Linux port - ToDo tmf.jar related
-					tx = new Current();
-					txnState = tx.get_status();
-*/
 
 					//**********************************************************
 					// *****************
@@ -500,32 +476,34 @@
 					// committed and autocommit
 					// * will be re-enabled.
 					//**********************************************************
-					// *****************
-/* Linux port - ToDo tmf.jar related
-					if (isAnyLob_ && (txnState == Current.StatusNoTransaction)
-							&& (connection_.autoCommit_)) {
-						currentTxid = connection_.getTxid_();
-						connection_.setTxid_(0);
-						tx.begin();
-						txBegin = true;
-						connection_.autoCommit_ = false;
-					}
-*/
+					long beginTime=0,endTime,timeTaken;
+					if (connection_.t2props.getQueryExecuteTime() > 0)
+						beginTime=System.currentTimeMillis();
+					boolean currentAC = connection_.autoCommit_;
+					if (isAnyLob_) {
+						if (outputDesc_ != null)
+							throw Messages.createSQLException(connection_.locale_, "lob_as_param_not_support", 
+								null);
+						else {
+							try {
+								lobLocators_ = getLobLocators();
+								setLobLocators();
+							}	
+							finally {
+							}
+						}
+					}	
+					else {
 					// Allocate the result set incase any rows are returned by
 					// the execute
-					if (outputDesc_ != null)
-						resultSet_ = new SQLMXResultSet(this, outputDesc_);
-					else
-						resultSet_ = null;
-					long beginTime=0,endTime,timeTaken;
-//					if ((T2Driver.queryExecuteTime_ > 0) || (SQLMXDataSource.queryExecuteTime_> 0) ) {
-					if(connection_.t2props.getQueryExecuteTime() > 0){
-						beginTime=System.currentTimeMillis();
-					}
+						if (outputDesc_ != null)
+							resultSet_ = new SQLMXResultSet(this, outputDesc_);
+						else
+							resultSet_ = null;
 
-					if (inputDesc_ != null) {
-						execute(connection_.server_, connection_.getDialogueId_(),
-								connection_.getTxid_(),
+						if (inputDesc_ != null) {
+							execute(connection_.server_, connection_.getDialogueId(),
+								connection_.getTxid(),
 								connection_.autoCommit_,
 								connection_.transactionMode_, stmtId_,
 								cursorName_, isSelect_, paramRowCount_ + 1,
@@ -533,94 +511,34 @@
 								queryTimeout_, isAnyLob_,
 								connection_.iso88591EncodingOverride_,
 								resultSet_, false);
-					} else {
-						execute(connection_.server_, connection_.getDialogueId_(),
-								connection_.getTxid_(),
+						} else {
+							execute(connection_.server_, connection_.getDialogueId(),
+								connection_.getTxid(),
 								connection_.autoCommit_,
 								connection_.transactionMode_, stmtId_,
 								cursorName_, isSelect_, paramRowCount_ + 1, 0,
 								null, queryTimeout_, isAnyLob_,
 								connection_.iso88591EncodingOverride_,
 								resultSet_, false);
+						}
 					}
-
-//					if ((T2Driver.queryExecuteTime_ > 0) || (SQLMXDataSource.queryExecuteTime_> 0) ) {
-					if(connection_.t2props.getQueryExecuteTime() > 0){
+					if (isAnyLob_)
+						populateLobObjects();
+					if (connection_.t2props.getQueryExecuteTime() > 0) {
 						endTime = System.currentTimeMillis();
 						timeTaken = endTime - beginTime;
 						printQueryExecuteTimeTrace(timeTaken);
 					}
 
-					if (resultSet_ != null) {
+					if (resultSet_ != null) 
 						ret = true;
-					} else {
-						if (isAnyLob_)
-							populateLobObjects();
-					}
-					//**********************************************************
-					// *****************
-					// * If LOB is involved with AutoCommit enabled an no
-					// external Txn,
-					// * commit transaction and re-enable autocommit
-					//**********************************************************
-					// *****************
-					if (txBegin) {
-						connection_.autoCommit_ = true;
-/* Linux port - ToDo tmf.jar related
-						tx.commit(false);
-*/
-						txBegin = false;
-					}
-				}// End sync
-			}
-/* Linux port - ToDo tmf.jar related
-			catch (com.tandem.util.FSException fe1) {
-				SQLException se1 = null;
-				SQLException se2 = null;
-
-				Object[] messageArguments1 = new Object[2];
-				messageArguments1[0] = Short.toString(fe1.error);
-				messageArguments1[1] = fe1.getMessage();
-				se1 = Messages.createSQLException(connection_.locale_,
-						"transaction_error_update", messageArguments1);
-
-				try {
-					if (txBegin)
-						tx.rollback();
-				} catch (com.tandem.util.FSException fe2) {
-					Object[] messageArguments2 = new Object[2];
-					messageArguments2[0] = Short.toString(fe2.error);
-					messageArguments2[1] = fe2.getMessage();
-					se2 = Messages.createSQLException(connection_.locale_,
-							"transaction_error_update", messageArguments2);
-					se2.setNextException(se1);
-					throw se2;
 				}
-
-				throw se1;
-			}
-*/
-			catch (SQLException se) {
-				SQLException se2 = null;
-/* Linux port - ToDo tmf.jar related
-				try {
-					if (txBegin)
-						tx.rollback();
-				} catch (com.tandem.util.FSException fe2) {
-					Object[] messageArguments = new Object[2];
-					messageArguments[0] = Short.toString(fe2.error);
-					messageArguments[1] = fe2.getMessage();
-					se2 = Messages.createSQLException(connection_.locale_,
-							"transaction_error_update", messageArguments);
-					se2.setNextException(se);
-					throw se2;
-				}
-*/
-				throw se;
 			} finally {
+/*
 				if (currentTxid != 0) {
 					connection_.setTxid_(currentTxid);
 				}
+*/
 			}
 
 			return ret;
@@ -663,13 +581,6 @@
 		try {
 			clearWarnings();
 			SQLException se;
-/* Linux port - ToDo tmf.jar related
-			Current tx = null;
-*/
-			int txnState = -1; // holds TMF transaction state code
-			boolean txBegin = false; // flag to indicate internal autcommit
-			// duties
-			int currentTxid = 0;
 			// Reset current txn ID at end if internal txn used for autocommit
 			// duties
 			boolean contBatchOnError = false;
@@ -679,7 +590,7 @@
 				throw new BatchUpdateException(se.getMessage(), se
 						.getSQLState(), new int[0]);
 			}
-
+/* Selva
 			// Throw a exception if it is a select statement
 			if (isSelect_) {
 				se = Messages.createSQLException(connection_.locale_,
@@ -687,6 +598,7 @@
 				throw new BatchUpdateException(se.getMessage(), se
 						.getSQLState(), new int[0]);
 			}
+*/
 			if (connection_.isClosed_) {
 
 				se = Messages.createSQLException(connection_.locale_,
@@ -696,16 +608,12 @@
 			}
 			synchronized (connection_) {
 				try {
-/* Linux port - ToDo tmf.jar related
-					tx = new Current();
-					txnState = tx.get_status();
-*/
 					//**********************************************************
 					// *****************
 					// * If LOB is involved with autocommit enabled an no
 					// external Txn, we must
 					// * perform the base table (execute) and LOB table
-					// (populateBatchLobObjects)
+					// (populateLobObjects)
 					// * updates/inserts as a single unit of work (data
 					// integrity issue).
 					// * These updates/inserts will be performed inside an
@@ -719,52 +627,51 @@
 					// * will be re-enabled.
 					//**********************************************************
 					// *****************
-/* Linux port - ToDo tmf.jar related
-					if (isAnyLob_ && (txnState == Current.StatusNoTransaction)
-							&& (connection_.autoCommit_)) {
-						currentTxid = connection_.getTxid_();
-						connection_.setTxid_(0);
-						tx.begin();
-						txBegin = true;
-						connection_.autoCommit_ = false;
-					}
-*/
 					if (connection_.contBatchOnErrorval_ == true)
 						contBatchOnError = true;
 
-					// Allocate the result set incase any rows are returned by
-					// the execute
-					if (outputDesc_ != null)
-						resultSet_ = new SQLMXResultSet(this, outputDesc_);
-					else
-						resultSet_ = null;
-
-
 					long beginTime=0,endTime,timeTaken;
-//					if ((T2Driver.queryExecuteTime_ > 0) || (SQLMXDataSource.queryExecuteTime_> 0) ) {
 					if(connection_.t2props.getQueryExecuteTime() > 0){
 					beginTime=System.currentTimeMillis();
 					}
+					if (isAnyLob_) {
+						if (outputDesc_ != null)
+							throw Messages.createSQLException(connection_.locale_, "lob_as_param_not_support", 
+								null);
+						else {
+							try {
+								lobLocators_ = getLobLocators();
+								setLobLocators();
+							}	
+							finally {
+							}
+						}
+					}	
+					else {
+					// Allocate the result set incase any rows are returned by
+					// the execute
+						if (outputDesc_ != null)
+							resultSet_ = new SQLMXResultSet(this, outputDesc_);
+						else
+							resultSet_ = null;
 
-					execute(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+						execute(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, stmtId_, cursorName_,
 							isSelect_, paramRowCount_, inputDesc_.length,
 							getParameters(), queryTimeout_,
-							lobObjects_ != null,
+							isAnyLob_,
 							connection_.iso88591EncodingOverride_, resultSet_,
 							contBatchOnError);
-
-
-
-//					if ((T2Driver.queryExecuteTime_ > 0) || (SQLMXDataSource.queryExecuteTime_> 0) ) {
+					}
+					if (isAnyLob_)
+						populateLobObjects();
 					if(connection_.t2props.getQueryExecuteTime() > 0){
 						endTime = System.currentTimeMillis();
 						timeTaken = endTime - beginTime;
 						printQueryExecuteTimeTrace(timeTaken);
 					}
 
-					populateBatchLobObjects();
 					//**********************************************************
 					// *****************
 					// * If LOB is involved with AutoCommit enabled an no
@@ -772,41 +679,7 @@
 					// * commit transaction and re-enable autocommit
 					//**********************************************************
 					// *****************
-					if (txBegin) {
-						connection_.autoCommit_ = true;
-/* Linux port - ToDo tmf.jar related
-						tx.commit(false);
-*/
-						txBegin = false;
-					}
 				}
-/* Linux port - ToDo tmf.jar related
-				catch (com.tandem.util.FSException fe1) {
-					SQLException se1 = null;
-					SQLException se2 = null;
-
-					Object[] messageArguments1 = new Object[2];
-					messageArguments1[0] = Short.toString(fe1.error);
-					messageArguments1[1] = fe1.getMessage();
-					se1 = Messages.createSQLException(connection_.locale_,
-							"transaction_error_update", messageArguments1);
-
-					try {
-						if (txBegin)
-							tx.rollback();
-					} catch (com.tandem.util.FSException fe2) {
-						Object[] messageArguments2 = new Object[2];
-						messageArguments2[0] = Short.toString(fe2.error);
-						messageArguments2[1] = fe2.getMessage();
-						se2 = Messages.createSQLException(connection_.locale_,
-								"transaction_error_update", messageArguments2);
-						se2.setNextException(se1);
-						throw se2;
-					}
-
-					throw se1;
-				}
-*/
 				catch (SQLException e) {
 					BatchUpdateException be;
 					SQLException se1 = null;
@@ -818,26 +691,8 @@
 					be = new BatchUpdateException(se.getMessage(), se
 							.getSQLState(), batchRowCount_);
 					be.setNextException(e);
-
-/* Linux port - ToDo tmf.jar related
-					try {
-						if (txBegin)
-							tx.rollback();
-					} catch (com.tandem.util.FSException fe2) {
-						Object[] messageArguments = new Object[2];
-						messageArguments[0] = Short.toString(fe2.error);
-						messageArguments[1] = fe2.getMessage();
-						se1 = Messages.createSQLException(connection_.locale_,
-								"transaction_error_update", messageArguments);
-						se1.setNextException(be);
-						throw se1;
-					}
-*/
 					throw be;
 				} finally {
-					if (currentTxid != 0) {
-						connection_.setTxid_(currentTxid);
-					}
 				}
 			}// End sync
 
@@ -891,8 +746,11 @@
 			// execute
 			if (outputDesc_ != null)
 				resultSet_ = new SQLMXResultSet(this, outputDesc_);
-			else
+			else {
+				executeUpdate();
 				resultSet_ = null;
+				return resultSet_;
+			}
 
 			long beginTime=0,endTime,timeTaken;
 //			if ((T2Driver.queryExecuteTime_ > 0) || (SQLMXDataSource.queryExecuteTime_> 0) ) {
@@ -901,16 +759,16 @@
 			}
 			synchronized (connection_) {
 				if (inputDesc_ != null) {
-					execute(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					execute(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, stmtId_, cursorName_,
 							isSelect_, paramRowCount_ + 1, inputDesc_.length,
 							getParameters(), queryTimeout_, isAnyLob_,
 							connection_.iso88591EncodingOverride_, resultSet_,
 							false);
 				} else {
-					execute(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					execute(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, stmtId_, cursorName_,
 							isSelect_, paramRowCount_ + 1, 0, null,
 							queryTimeout_, isAnyLob_,
@@ -955,13 +813,6 @@
 		if (JdbcDebugCfg.entryActive)
 			debug[methodId_executeUpdate].methodEntry();
 		try {
-/* Linux port - ToDo tmf.jar related
-			Current tx = null;
-*/
-			int txnState = -1; // holds TMF transaction state code
-			boolean txBegin = false; // flag to indicate internal autcommit
-			// duties
-			int currentTxid = 0;
 			// Reset current txn ID at end if internal txn used for autocommit
 			// duties
 
@@ -980,10 +831,6 @@
 			synchronized (connection_) {
 				if (inputDesc_ != null) {
 					try {
-/* Linux port - ToDo tmf.jar related
-						tx = new Current();
-						txnState = tx.get_status();
-*/
 
 						//******************************************************
 						// *********************
@@ -1004,26 +851,26 @@
 						// * will be re-enabled.
 						//******************************************************
 						// *********************
-/* Linux port - ToDo tmf.jar related
-						if (isAnyLob_
-								&& (txnState == Current.StatusNoTransaction)
-								&& (connection_.autoCommit_)) {
-							currentTxid = connection_.getTxid_();
-							connection_.setTxid_(0);
-
-							tx.begin();
-							txBegin = true;
-							connection_.autoCommit_ = false;
-						}
-*/
-
-						long beginTime=0,endTime,timeTaken;
-//						if ((T2Driver.queryExecuteTime_ > 0) || (SQLMXDataSource.queryExecuteTime_> 0) ) {
-						if(connection_.t2props.getQueryExecuteTime() > 0){
-						beginTime=System.currentTimeMillis();
-						}
-						execute(connection_.server_, connection_.getDialogueId_(),
-								connection_.getTxid_(),
+						if (isAnyLob_) {
+							if (outputDesc_ != null)
+								throw Messages.createSQLException(connection_.locale_, "lob_as_param_not_support", 
+									null);
+							else {
+								try {
+									lobLocators_ = getLobLocators();
+									setLobLocators();
+								}	
+								finally {
+								}
+							}
+						}	
+						else {
+							long beginTime=0,endTime,timeTaken;
+							if(connection_.t2props.getQueryExecuteTime() > 0){
+								beginTime=System.currentTimeMillis();
+							}
+							execute(connection_.server_, connection_.getDialogueId(),
+								connection_.getTxid(),
 								connection_.autoCommit_,
 								connection_.transactionMode_, stmtId_,
 								cursorName_, isSelect_, paramRowCount_ + 1,
@@ -1032,11 +879,11 @@
 								connection_.iso88591EncodingOverride_,
 								resultSet_, false);
 
-//						if ((T2Driver.queryExecuteTime_ > 0) || (SQLMXDataSource.queryExecuteTime_> 0) ) {
-						if(connection_.t2props.getQueryExecuteTime() > 0){
-							endTime = System.currentTimeMillis();
-							timeTaken = endTime - beginTime;
-							printQueryExecuteTimeTrace(timeTaken);
+							if (connection_.t2props.getQueryExecuteTime() > 0){
+								endTime = System.currentTimeMillis();
+								timeTaken = endTime - beginTime;
+								printQueryExecuteTimeTrace(timeTaken);
+							}
 						}
 						if (isAnyLob_)
 							populateLobObjects();
@@ -1048,67 +895,7 @@
 						// * commit transaction and re-enable autocommit
 						//******************************************************
 						// *********************
-						if (txBegin) {
-							connection_.autoCommit_ = true;
-/* Linux port - ToDo tmf.jar related
-							tx.commit(false);
-*/
-							txBegin = false;
-						}
-					}
-/* Linux port - ToDo tmf.jar related
-					catch (com.tandem.util.FSException fe1) {
-						SQLException se1 = null;
-						SQLException se2 = null;
-
-						Object[] messageArguments1 = new Object[2];
-						messageArguments1[0] = Short.toString(fe1.error);
-						messageArguments1[1] = fe1.getMessage();
-						se1 = Messages.createSQLException(connection_.locale_,
-								"transaction_error_update", messageArguments1);
-
-						try {
-							if (txBegin)
-								tx.rollback();
-						} catch (com.tandem.util.FSException fe2) {
-							Object[] messageArguments2 = new Object[2];
-							messageArguments2[0] = Short.toString(fe2.error);
-							messageArguments2[1] = fe2.getMessage();
-							se2 = Messages.createSQLException(
-									connection_.locale_,
-									"transaction_error_update",
-									messageArguments2);
-							se2.setNextException(se1);
-							throw se2;
-						}
-
-						throw se1;
-					}
-*/
-					catch (SQLException se) {
-						SQLException se2 = null;
-
-/* Linux port - ToDo tmf.jar related
-						try {
-							if (txBegin)
-								tx.rollback();
-						} catch (com.tandem.util.FSException fe2) {
-							Object[] messageArguments = new Object[2];
-							messageArguments[0] = Short.toString(fe2.error);
-							messageArguments[1] = fe2.getMessage();
-							se2 = Messages.createSQLException(
-									connection_.locale_,
-									"transaction_error_update",
-									messageArguments);
-							se2.setNextException(se);
-							throw se2;
-						}
-*/
-						throw se;
 					} finally {
-						if (currentTxid != 0) {
-							connection_.setTxid_(currentTxid);
-						}
 					}
 				} else {
 					long beginTime=0,endTime,timeTaken;
@@ -1116,8 +903,8 @@
 					if(connection_.t2props.getQueryExecuteTime() > 0){
 					beginTime=System.currentTimeMillis();
 					}
-					execute(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					execute(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, stmtId_, cursorName_,
 							isSelect_, paramRowCount_ + 1, 0, null,
 							queryTimeout_, isAnyLob_,
@@ -1177,24 +964,6 @@
 		}
 	}
 
-	/**
-	 * Sets the designated parameter to the given <tt>Array</tt> object. The
-	 * driver converts this to an SQL <tt>ARRAY</tt> value when it sends it to
-	 * the database.
-	 * <p>
-	 * <B>Note:</B>This method is <em><B>unsupported</B></em> by the Trafodion JDBC
-	 * driver. If this method is called a <i>Unsupported feature -
-	 * {setArray())</i> SQLException will be thrown.
-	 * </p>
-	 *
-	 * @param i
-	 *            the first parameter is 1, the second is 2, ...
-	 * @param x
-	 *            an object representing an SQL array
-	 *
-	 * @throws SQLException
-	 *             Unsupported feature.
-	 */
 	public void setArray(int parameterIndex, Array x) throws SQLException {
 		if (JdbcDebugCfg.entryActive)
 			debug[methodId_setArray].methodEntry();
@@ -1208,38 +977,6 @@
 		}
 	}
 
-	/**
-	 * Sets the designated parameter to the given input stream, which will have
-	 * the specified number of bytes. When a very large ASCII value is input to
-	 * a <tt>LONGVARCHAR</tt> parameter, it may be more practical to send it via
-	 * a <tt>java.io.InputStream</tt>. Data will be read from the stream as
-	 * needed until end-of-file is reached. The JDBC driver will do any
-	 * necessary conversion from ASCII to the database char format.
-	 * <P>
-	 * <B>Note:</B> This stream object can either be a standard Java stream
-	 * object or your own subclass that implements the standard interface.
-	 * </p>
-	 * <p>
-	 * This API call <em><B>can only</B></em> be used to read into a SQL column
-	 * type <tt>CLOB</tt>, <tt>CHAR</tt>, <tt>VARCHAR</tt>, <tt>LONVARCHAR</tt>,
-	 * <tt>BINARY</tt>, <tt>VARBINARY</tt>, or <tt>LONGVARBINARY</tt>.
-	 *
-	 * @param parameterIndex
-	 *            the first parameter is 1...
-	 * @param x
-	 *            the Java input stream that contains the ASCII parameter value
-	 * @param length
-	 *            the number of bytes in the stream
-	 *
-	 * @exception SQLException
-	 *                restricted data type
-	 * @exception SQLException
-	 *                unsupported encoding
-	 * @exception SQLException
-	 *                I/O error
-	 * @exception SQLException
-	 *                invalid data type for column
-	 */
 	public void setAsciiStream(int parameterIndex, InputStream x, int length)
 			throws SQLException {
 		if (JdbcDebugCfg.entryActive)
@@ -1247,37 +984,51 @@
 		try {
 			byte[] buffer;
 			int dataType;
-			long dataLocator;
 
 			validateSetInvocation(parameterIndex);
 			dataType = inputDesc_[parameterIndex - 1].dataType_;
 
-			if (x == null) {
-				paramContainer_.setNull(parameterIndex);
-			} else {
-				switch (dataType) {
-				case Types.CLOB:
-					dataLocator = connection_.getDataLocator(
-							connection_.clobTableName_, false);
-					SQLMXClob clob = new SQLMXClob(connection_,
-							inputDesc_[parameterIndex - 1].tableName_,
-							dataLocator, x, length);
-					inputDesc_[parameterIndex - 1].paramValue_ = clob;
-					isAnyLob_ = true;
-					paramContainer_.setLong(parameterIndex, dataLocator);
-					break;
-				case Types.BLOB:
-					throw Messages.createSQLException(connection_.locale_,
-							"restricted_data_type", null);
-				case Types.CHAR:
-				case Types.VARCHAR:
-				case Types.LONGVARCHAR:
-				case Types.BINARY: // At this time SQL/MX does not have this
-					// column data type
-				case Types.VARBINARY: // At this time SQL/MX does not have this
-					// column data type
-				case Types.LONGVARBINARY: // At this time SQL/MX does not have
-					// this column data type
+			switch (dataType) {
+			case Types.CLOB:
+				SQLMXClob clob = null;
+				if (x == null) 
+					paramContainer_.setNull(parameterIndex);
+				else {
+					if (length <= connection_.getInlineLobChunkSize()) {
+						try {
+							int bufLength; 
+							byte[] buf = new byte[length];
+							bufLength = x.read(buf);
+							String inStr;
+							if (bufLength == length)
+								inStr = new String(buf);
+							else
+								inStr = new String(buf, 0, bufLength);
+							paramContainer_.setString(parameterIndex, inStr);
+						} catch (IOException ioe) {
+							throw new SQLException(ioe);
+						}
+					} else {			
+						isAnyLob_ = true;
+						clob = new SQLMXClob(connection_, null, x, length);
+						inputDesc_[parameterIndex - 1].paramValue_ = "";
+						paramContainer_.setString(parameterIndex, "");
+					}
+				}
+				addLobObjects(parameterIndex, clob);
+				break;
+			case Types.BLOB:
+				throw Messages.createSQLException(connection_.locale_,
+						"restricted_data_type", null);
+			case Types.CHAR:
+			case Types.VARCHAR:
+			case Types.LONGVARCHAR:
+			case Types.BINARY: // At this time SQL/MX does not have this column data type
+			case Types.VARBINARY: // At this time SQL/MX does not have this column data type
+			case Types.LONGVARBINARY: // At this time SQL/MX does not have this column data type
+				if (x == null) 
+					paramContainer_.setNull(parameterIndex);
+				else {
 					buffer = new byte[length];
 					try {
 						x.read(buffer);
@@ -1296,11 +1047,11 @@
 						throw Messages.createSQLException(connection_.locale_,
 								"unsupported_encoding", messageArguments);
 					}
-					break;
-				default:
-					throw Messages.createSQLException(connection_.locale_,
-							"invalid_datatype_for_column", null);
 				}
+				break;
+			default:
+				throw Messages.createSQLException(connection_.locale_,
+							"invalid_datatype_for_column", null);
 			}
 			inputDesc_[parameterIndex - 1].isValueSet_ = true;
 		} finally {
@@ -1309,49 +1060,6 @@
 		}
 	}
 
-	/**
-	 * Sets the designated parameter to the given <tt>java.math.BigDecimal</tt>
-	 * value. The driver converts this to a SQL <tt>NUMERIC</tt> value when it
-	 * sends it to the database.
-	 * <p>
-	 * <B>Note:</B> An <em>extended</em> feature of the Trafodion JDBC driver will
-	 * allow the setBigDecimal to write data to any compatible SQL column type.
-	 * The given <tt>java.math.BigDecimal</tt> value is converted to the correct
-	 * SQL column type, before the data is written to the database. If the
-	 * conversion can not be performed, then the SQLException
-	 * "conversion not allowed" will be thrown.
-	 * </p>
-	 * <p>
-	 * The compatible SQL column types are:
-	 *
-	 * <ul PLAIN> <tt>TINYINT</tt> </ul> <ul PLAIN> <tt>SMALLINT</tt> </ul> <ul
-	 * PLAIN> <tt>INTEGER</tt> </ul> <ul PLAIN> <tt>BIGINT</tt> </ul> <ul PLAIN>
-	 * <tt>REAL</tt> </ul> <ul PLAIN> <tt>DOUBLE</tt> </ul> <ul PLAIN>
-	 * <tt>DECIMAL</tt> </ul> <ul PLAIN> <tt>NUMERIC</tt> </ul> <ul PLAIN>
-	 * <tt>BOOLEAN</tt> </ul> <ul PLAIN> <tt>CHAR</tt> </ul> <ul PLAIN>
-	 * <tt>VARCHAR</tt> </ul> <ul PLAIN> <tt>LONGVARCHAR</tt> </ul>
-	 * </p>
-	 * <p>
-	 * A non-compatible SQL column type will result in a <i>Java data type does
-	 * not match SQL data type for column</i> SQLException being thrown.
-	 *
-	 * @param parameterIndex
-	 *            the first parameter is 1...
-	 * @param x
-	 *            the parameter value
-	 *
-	 * @exception SQLException
-	 *                wrong data type for the column
-	 * @exception SQLException
-	 *                the scale value was negative
-	 * @exception SQLException
-	 *                the data is out of range(value was too big or small for
-	 *                the column)
-	 * @exception SQLException
-	 *                writing a negative value to an unsigned column
-	 * @warning SQLWarning that the data value was rounded up
-	 *
-	 */
 	public void setBigDecimal(int parameterIndex, BigDecimal x)
 			throws SQLException {
 		/*
@@ -1681,40 +1389,57 @@
 		try {
 			byte[] buffer;
 			int dataType;
-			long dataLocator;
 
 			validateSetInvocation(parameterIndex);
 			dataType = inputDesc_[parameterIndex - 1].dataType_;
 
-			if (x == null) {
-				paramContainer_.setNull(parameterIndex);
-			} else {
-				switch (dataType) {
-				case Types.CLOB:
-					throw Messages.createSQLException(connection_.locale_,
-							"restricted_data_type", null);
-				case Types.BLOB:
-					dataLocator = connection_.getDataLocator(
-							connection_.blobTableName_, true);
-					SQLMXBlob blob = new SQLMXBlob(connection_,
-							inputDesc_[parameterIndex - 1].tableName_,
-							dataLocator, x, length);
-					isAnyLob_ = true;
-					inputDesc_[parameterIndex - 1].paramValue_ = blob;
-					isAnyLob_ = true;
-					paramContainer_.setLong(parameterIndex, dataLocator);
-					break;
-				case Types.DOUBLE:
-				case Types.DECIMAL:
-				case Types.NUMERIC:
-				case Types.FLOAT:
-				case Types.BIGINT:
-				case Types.INTEGER:
-				case Types.SMALLINT:
-				case Types.TINYINT:
-					throw Messages.createSQLException(connection_.locale_,
+			switch (dataType) {
+			case Types.CLOB:
+				throw Messages.createSQLException(connection_.locale_,
+						"restricted_data_type", null);
+			case Types.BLOB:
+				SQLMXBlob blob = null;
+				if (x == null) 
+					paramContainer_.setNull(parameterIndex);
+				else {
+					if (length <= connection_.getInlineLobChunkSize()) {
+						try {
+							int bufLength; 
+							byte[] buf = new byte[length];
+							bufLength = x.read(buf);
+							byte[] inBuf;
+							if (bufLength == length)
+								inBuf = buf;
+							else
+								inBuf = Arrays.copyOf(buf, bufLength);
+							paramContainer_.setBytes(parameterIndex, inBuf);
+						} catch (IOException ioe) {
+							throw new SQLException(ioe);
+						}
+					} else {			
+						isAnyLob_ = true;
+						blob = new SQLMXBlob(connection_, null, x, length);
+						inputDesc_[parameterIndex - 1].paramValue_ = "";
+						paramContainer_.setBytes(parameterIndex, new byte[0]);
+					}
+				}
+				addLobObjects(parameterIndex, blob);
+				break;
+			case Types.DOUBLE:
+			case Types.DECIMAL:
+			case Types.NUMERIC:
+			case Types.FLOAT:
+			case Types.BIGINT:
+			case Types.INTEGER:
+			case Types.SMALLINT:
+			case Types.TINYINT:
+				throw Messages.createSQLException(connection_.locale_,
 							"invalid_datatype_for_column", null);
-				default:
+			default:
+				if (x == null) { 
+					paramContainer_.setNull(parameterIndex);
+				}
+				else {
 					buffer = new byte[length];
 
 					try {
@@ -1757,25 +1482,28 @@
 					.toString(parameterIndex)
 					+ ",?");
 		try {
-			int dataType;
-			long dataLocator;
-			if (x == null) {
-				setNull(parameterIndex, java.sql.Types.BLOB);
-				return;
-			}
-
 			validateSetInvocation(parameterIndex);
+			int dataType = inputDesc_[parameterIndex - 1].dataType_;
 			dataType = inputDesc_[parameterIndex - 1].dataType_;
 			switch (dataType) {
 			case Types.BLOB:
-				dataLocator = connection_.getDataLocator(
-						connection_.blobTableName_, true);
-				SQLMXBlob blob = new SQLMXBlob(connection_,
-						inputDesc_[parameterIndex - 1].tableName_, dataLocator,
-						x);
-				inputDesc_[parameterIndex - 1].paramValue_ = blob;
+				SQLMXBlob blob = null;
 				isAnyLob_ = true;
-				paramContainer_.setLong(parameterIndex, dataLocator);
+				if (x == null) 
+					setNull(parameterIndex, Types.BLOB);
+				else {
+					byte[] b = null;
+					if ((x instanceof SQLMXBlob) && 
+							((b = ((SQLMXBlob)x).getBytes(connection_.getInlineLobChunkSize())) != null)) {
+						paramContainer_.setBytes(parameterIndex, b);
+					} else {
+						isAnyLob_ = true;
+						blob = new SQLMXBlob(connection_, null, x);
+						inputDesc_[parameterIndex - 1].paramValue_ = "";
+						paramContainer_.setBytes(parameterIndex, new byte[0]);
+					}
+				}
+				addLobObjects(parameterIndex, blob);
 				break;
 			default:
 				throw Messages.createSQLException(connection_.locale_,
@@ -1946,46 +1674,45 @@
 					.toString(parameterIndex)
 					+ ",byte[]");
 		try {
-			int dataType;
+			validateSetInvocation(parameterIndex);
+			int dataType = inputDesc_[parameterIndex - 1].dataType_;
+            		int dataCharSet = inputDesc_[parameterIndex - 1].sqlCharset_;
 
-			if (x == null) {
+			if (x == null && dataType != Types.CLOB && dataType != Types.BLOB) {
 				setNull(parameterIndex, java.sql.Types.LONGVARBINARY);
-				return;
 			}
 
-
-			//byte[] tmpArray = new byte[x.length];
-			//System.arraycopy(x, 0, tmpArray, 0, x.length);
-
-			validateSetInvocation(parameterIndex);
-			dataType = inputDesc_[parameterIndex - 1].dataType_;
-            int dataCharSet = inputDesc_[parameterIndex - 1].sqlCharset_;
 			switch (dataType) {
 			case Types.BLOB:
-				long dataLocator = connection_.getDataLocator(
-						connection_.blobTableName_, true);
-				SQLMXBlob blob = new SQLMXBlob(connection_,
-						inputDesc_[parameterIndex - 1].tableName_, dataLocator,
-						x);
-				inputDesc_[parameterIndex - 1].paramValue_ = blob;
-				isAnyLob_ = true;
-				paramContainer_.setLong(parameterIndex, dataLocator);
+				SQLMXBlob blob = null;
+				if (x == null) 
+					paramContainer_.setNull(parameterIndex);
+				else {
+					if (x.length <= connection_.getInlineLobChunkSize()) 
+						paramContainer_.setBytes(parameterIndex, x);
+					else {
+						isAnyLob_ = true;
+						blob = new SQLMXBlob(connection_, null, x);
+						inputDesc_[parameterIndex - 1].paramValue_ = "";
+						paramContainer_.setBytes(parameterIndex, new byte[0]);
+					}
+				}
+				addLobObjects(parameterIndex, blob);
 				break;
-            case Types.CHAR:
-            case Types.VARCHAR:
-            case Types.LONGVARCHAR:
-                String charSet = SQLMXDesc.SQLCHARSETSTRING_ISO88591;
-                if (dataCharSet == SQLMXDesc.SQLCHARSETCODE_UCS2)
-                    charSet = "UTF-16LE";
-                try {
-                    x = (new String(x)).getBytes(charSet);
-                } catch (UnsupportedEncodingException e) {
-                    e.printStackTrace();
-                    throw Messages.createSQLException(connection_.locale_, "unsupported_encoding",
-                            new Object[] { charSet });
-                }
-                paramContainer_.setObject(parameterIndex, x);
-                break;
+			case Types.CHAR:
+			case Types.VARCHAR:
+			case Types.LONGVARCHAR:
+				String charSet = SQLMXDesc.SQLCHARSETSTRING_ISO88591;
+				if (dataCharSet == SQLMXDesc.SQLCHARSETCODE_UCS2)
+					charSet = "UTF-16LE";
+				try {
+					x = (new String(x)).getBytes(charSet);
+				} catch (UnsupportedEncodingException e) {
+					throw Messages.createSQLException(connection_.locale_, "unsupported_encoding",
+						new Object[] { charSet });
+				}
+				paramContainer_.setObject(parameterIndex, x);
+				break;
 			case Types.DATE:
 			case Types.TIME:
 			case Types.TIMESTAMP:
@@ -2055,34 +1782,53 @@
 			validateSetInvocation(parameterIndex);
 			dataType = inputDesc_[parameterIndex - 1].dataType_;
 
-			if (reader == null) {
-				paramContainer_.setNull(parameterIndex);
-			} else {
-				switch (dataType) {
-				case Types.CLOB:
-					long dataLocator = connection_.getDataLocator(
-							connection_.clobTableName_, false);
-					SQLMXClob clob = new SQLMXClob(connection_,
-							inputDesc_[parameterIndex - 1].tableName_,
-							dataLocator, reader, length);
-					inputDesc_[parameterIndex - 1].paramValue_ = clob;
-					isAnyLob_ = true;
-					paramContainer_.setLong(parameterIndex, dataLocator);
-					break;
-				case Types.BLOB:
-					throw Messages.createSQLException(connection_.locale_,
+			switch (dataType) {
+			case Types.CLOB:
+				SQLMXClob clob = null;
+				if (reader == null) 
+					paramContainer_.setNull(parameterIndex);
+				else {
+					if (length <= connection_.getInlineLobChunkSize()) {
+						try {
+							int bufLength; 
+							char[] buf = new char[length];
+							bufLength = reader.read(buf);
+							String inStr;
+							if (bufLength == length)
+								inStr = new String(buf);
+							else
+								inStr = new String(buf, 0, bufLength);
+							paramContainer_.setString(parameterIndex, inStr);
+						} catch (IOException ioe) {
+							throw new SQLException(ioe);
+						}
+					} else {
+						isAnyLob_ = true;
+						clob = new SQLMXClob(connection_, null, reader, length);
+						inputDesc_[parameterIndex - 1].paramValue_ = "";
+						paramContainer_.setString(parameterIndex, "");
+					}
+				}
+				addLobObjects(parameterIndex, clob);
+				break;
+			case Types.BLOB:
+				throw Messages.createSQLException(connection_.locale_,
 							"restricted_data_type", null);
-				case Types.DECIMAL:
-				case Types.DOUBLE:
-				case Types.FLOAT:
-				case Types.NUMERIC:
-				case Types.BIGINT:
-				case Types.INTEGER:
-				case Types.SMALLINT:
-				case Types.TINYINT:
-					throw Messages.createSQLException(connection_.locale_,
+			case Types.DECIMAL:
+			case Types.DOUBLE:
+			case Types.FLOAT:
+			case Types.NUMERIC:
+			case Types.BIGINT:
+			case Types.INTEGER:
+			case Types.SMALLINT:
+			case Types.TINYINT:
+				throw Messages.createSQLException(connection_.locale_,
 							"invalid_datatype_for_column", null);
-				default:
+			default:
+				if (reader == null) 
+					paramContainer_.setNull(parameterIndex);
+				else {
+				
 					buffer = new char[length];
 					try {
 						reader.read(buffer);
@@ -2124,27 +1870,26 @@
 					.toString(parameterIndex)
 					+ ",?");
 		try {
-			int dataType;
-			long dataLocator;
-
-			if (x == null) {
-				setNull(parameterIndex, Types.CLOB);
-				return;
-			}
-
-
 			validateSetInvocation(parameterIndex);
-			dataType = inputDesc_[parameterIndex - 1].dataType_;
+			int dataType = inputDesc_[parameterIndex - 1].dataType_;
 			switch (dataType) {
 			case Types.CLOB:
-				dataLocator = connection_.getDataLocator(
-						connection_.clobTableName_, false);
-				SQLMXClob clob = new SQLMXClob(connection_,
-						inputDesc_[parameterIndex - 1].tableName_, dataLocator,
-						x);
-				inputDesc_[parameterIndex - 1].paramValue_ = clob;
-				isAnyLob_ = true;
-				paramContainer_.setLong(parameterIndex, dataLocator);
+				SQLMXClob clob = null;
+				if (x == null) 
+					setNull(parameterIndex, Types.CLOB);
+				else {
+					String inStr = null;
+					if ((x instanceof SQLMXClob) && 
+							((inStr = ((SQLMXClob)x).getString(connection_.getInlineLobChunkSize())) != null)) {
+						paramContainer_.setString(parameterIndex, inStr);
+					} else {
+						isAnyLob_ = true;
+						clob = new SQLMXClob(connection_, null, x);
+						inputDesc_[parameterIndex - 1].paramValue_ = "";
+						paramContainer_.setString(parameterIndex, "");
+					}
+				}
+				addLobObjects(parameterIndex, clob);
 				break;
 			case Types.DECIMAL:
 			case Types.DOUBLE:
@@ -2500,7 +2245,7 @@
 
 				synchronized (connection_) {
 					// Pass the fetch size change to the driver
-					resetFetchSize(connection_.getDialogueId_(), stmtId_, fetchSize_);
+					resetFetchSize(connection_.getDialogueId(), stmtId_, fetchSize_);
 				}
 			}
 		} finally {
@@ -4164,15 +3909,12 @@
 					.toString(parameterIndex)
 					+ "," + x);
 		try {
-			long dataLocator;
-
 			validateSetInvocation(parameterIndex);
+			int dataType = inputDesc_[parameterIndex - 1].dataType_;
 
-			if (x == null) {
+			if (x == null && dataType != Types.CLOB && dataType != Types.BLOB) {
 				setNull(parameterIndex, Types.NULL);
 			} else {
-				int dataType = inputDesc_[parameterIndex - 1].dataType_;
-
 				switch (dataType) {
 				case Types.CHAR:
 				case Types.VARCHAR:
@@ -4204,15 +3946,36 @@
 					paramContainer_.setString(parameterIndex, x);
 					break;
 				case Types.CLOB: // WLS extension: CLOB should to be able to
-					// write to string, deviation from API.
-					dataLocator = connection_.getDataLocator(
-							connection_.clobTableName_, false);
-					SQLMXClob clob = new SQLMXClob(connection_,
-							inputDesc_[parameterIndex - 1].tableName_,
-							dataLocator, x);
-					inputDesc_[parameterIndex - 1].paramValue_ = clob;
-					isAnyLob_ = true;
-					paramContainer_.setLong(parameterIndex, dataLocator);
+					SQLMXClob clob = null;
+					if (x == null) 
+						paramContainer_.setNull(parameterIndex);
+					else {
+						if (x.length() <= connection_.getInlineLobChunkSize()) {
+							paramContainer_.setString(parameterIndex, x);
+						} else {
+							isAnyLob_ = true;
+							clob = new SQLMXClob(connection_, null, x);
+							inputDesc_[parameterIndex - 1].paramValue_ = "";
+							paramContainer_.setString(parameterIndex, "");
+						}
+					}
+					addLobObjects(parameterIndex, clob);
+					break;
+				case Types.BLOB:
+					SQLMXBlob blob = null;
+					if (x == null) 
+						paramContainer_.setNull(parameterIndex);
+					else {
+						if (x.length() <= connection_.getInlineLobChunkSize()) {
+							paramContainer_.setBytes(parameterIndex, x.getBytes());
+						} else {
+							isAnyLob_ = true;
+							blob = new SQLMXBlob(connection_, null, x.getBytes());
+							inputDesc_[parameterIndex - 1].paramValue_ = "";
+							paramContainer_.setBytes(parameterIndex, new byte[0]);
+						}
+					}
+					addLobObjects(parameterIndex, blob);
 					break;
 				case Types.ARRAY:
 				case Types.BINARY:
@@ -4234,7 +3997,6 @@
 					dataWrapper.setString(1, x.trim());
 					setObject(parameterIndex, dataWrapper, dataType);
 					break;
-				case Types.BLOB:
 				case Types.BOOLEAN:
 				case Types.DOUBLE:
 				case Types.FLOAT:
@@ -4729,9 +4491,6 @@
 			if (paramRowCount_ > 0)
 				throw Messages.createSQLException(connection_.locale_,
 						"function_sequence_error", null);
-			if (isCQD) {
-				connection_.setOfCQDs.add(sql_);
-			}
 			checkIfAllParamsSet();
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -4811,6 +4570,15 @@
 		}
 	}
 
+	 void copyParameters(SQLMXPreparedStatement other) 
+	{
+		paramRowCount_ = other.paramRowCount_;
+		paramContainer_ = other.paramContainer_;
+		rowsValue_ = other.rowsValue_;
+		for (int paramNumber = 0; paramNumber < inputDesc_.length; paramNumber++)
+			inputDesc_[paramNumber].isValueSet_ = true;
+	}
+
 	void logicalClose() throws SQLException {
 		if (JdbcDebugCfg.entryActive)
 			debug[methodId_logicalClose].methodEntry();
@@ -4903,7 +4671,7 @@
 				}
 
 				// Check if the transaction is started by this Select statement
-				if (connection_.getTxid_() == 0 && txid != 0)
+				if (connection_.getTxid() == 0 && txid != 0)
 					resultSet_.txnStarted_ = true;
 				rowCount_ = -1;
 			} else {
@@ -5104,7 +4872,7 @@
 					return;
 				try {
 					if (hardClose){
-						close(connection_.server_, connection_.getDialogueId_(),
+						close(connection_.server_, connection_.getDialogueId(),
 								stmtId_, true);
 					connection_.hClosestmtCount++;
 
@@ -5137,29 +4905,6 @@
 		if (JdbcDebugCfg.entryActive)
 			debug[methodId_populateLobObjects].methodEntry();
 		try {
-			Object lob;
-
-			if (isAnyLob_) {
-				for (int i = 0; i < inputDesc_.length; i++) {
-					if (inputDesc_[i].paramValue_ != null) {
-						lob = inputDesc_[i].paramValue_;
-						if (lob instanceof SQLMXClob)
-							((SQLMXClob) lob).populate();
-						else
-							((SQLMXBlob) lob).populate();
-					}
-				}
-			}
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_populateLobObjects].methodExit();
-		}
-	}
-
-	void populateBatchLobObjects() throws SQLException {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_populateBatchLobObjects].methodEntry();
-		try {
 			int len;
 			Object lob;
 
@@ -5167,43 +4912,16 @@
 				len = lobObjects_.size();
 				for (int i = 0; i < len; i++) {
 					lob = lobObjects_.get(i);
-					if (lob instanceof SQLMXClob)
+					if (lob instanceof SQLMXClob) 
 						((SQLMXClob) lob).populate();
 					else
 						((SQLMXBlob) lob).populate();
 				}
 			}
+			isAnyLob_ = false;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
-				debug[methodId_populateBatchLobObjects].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();
+				debug[methodId_populateLobObjects].methodExit();
 		}
 	}
 
@@ -5233,8 +4951,8 @@
 				throw Messages.createSQLException(connection_.locale_,
 						"invalid_connection", null);
 			isSelect_ = getStmtSqlType(sql);
-			sql_ = scanSqlStr(sql).trim();
 			short stmtType = SQLMXConnection.getSqlStmtType(sql);
+			sql_ = sql;
 			this.setSqlType(stmtType);
 			if(stmtType == SQLMXConnection.TYPE_CONTROL){
 				isCQD = true;
@@ -5250,35 +4968,6 @@
 		}
 	}
 
-	SQLMXPreparedStatement(SQLMXConnection connection, String moduleName,
-			int moduleVersion, long moduleTimestamp, String stmtName,
-			boolean isSelect, int holdability) {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_SQLMXPreparedStatement_LLIJLZI].methodEntry();
-		try {
-			connection_ = connection;
-			moduleName_ = moduleName;
-			moduleVersion_ = moduleVersion;
-			moduleTimestamp_ = moduleTimestamp;
-			setStmtLabel_(stmtName);
-			isSelect_ = isSelect;
-
-			// Make Sure you initialize the other fields to the right value
-			fetchSize_ = SQLMXResultSet.DEFAULT_FETCH_SIZE;
-			maxRows_ = 0;
-			fetchDirection_ = ResultSet.FETCH_FORWARD;
-			queryTimeout_ = connection_.queryTimeout_;
-			resultSetType_ = ResultSet.TYPE_FORWARD_ONLY;
-			resultSetHoldability_ = holdability;
-			pRef_ = new WeakReference<SQLMXStatement>(this, connection_.refQ_);
-			batchBindingSize_ = connection.batchBindingSize_;
-			nf.setGroupingUsed(false);
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_SQLMXPreparedStatement_LLIJLZI].methodExit();
-		}
-	}
-
 	// native methods
 	native void prepare(String server, long dialogueId, int txid,
 			boolean autoCommit, String stmtLabel, String sql, boolean isSelect,
@@ -5291,12 +4980,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
@@ -5310,7 +4993,11 @@
 	ArrayList<Object> rowsValue_;
 	DataWrapper paramContainer_;
 	boolean isAnyLob_;
-	ArrayList<Object> lobObjects_;
+	ArrayList<SQLMXLob> lobObjects_;
+	ArrayList<String> lobColNames_;
+	ArrayList<Integer> lobColIds_;
+	String[] lobLocators_;
+	boolean lobColDone_;
 
 	boolean isCQD;
 	short sqlType;
@@ -5442,14 +5129,12 @@
 	private static int methodId_reuse = 61;
 	private static int methodId_close = 62;
 	private static int methodId_populateLobObjects = 63;
-	private static int methodId_populateBatchLobObjects = 64;
-	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;
 
@@ -5558,9 +5243,6 @@
 			debug[methodId_close] = new JdbcDebug(className, "close");
 			debug[methodId_populateLobObjects] = new JdbcDebug(className,
 					"populateLobObjects");
-			debug[methodId_populateBatchLobObjects] = new JdbcDebug(className,
-					"populateBatchLobObjects");
-			debug[methodId_cpqPrepare] = new JdbcDebug(className, "cpqPrepare");
 			debug[methodId_SQLMXPreparedStatement_LLIII] = new JdbcDebug(
 					className, "SQLMXPreparedStatement_LLIII");
 			debug[methodId_SQLMXPreparedStatement_LLIJLZI] = new JdbcDebug(
@@ -5724,5 +5406,91 @@
     public String getInputDescName(int parameterIndex){
         return inputDesc_[parameterIndex].name_;
     }
+
+	private void addLobObjects(int parameterIndex, SQLMXLob x)
+	{
+		if (lobObjects_ == null) {
+			lobObjects_ = new ArrayList<SQLMXLob>();
+			lobColNames_ = new ArrayList<String>();
+			lobColIds_ = new ArrayList<Integer>();
+		}
+		if (! lobColDone_) {	
+			lobColNames_.add(getInputDescName(parameterIndex-1));
+			lobColIds_.add(parameterIndex);
+		}
+		lobObjects_.add(x);
+	}
+
+	private int getNumLobColumns() 
+	{
+		if (lobColNames_ == null)
+			return 0;
+		else
+			return lobColNames_.size();
+	}
+
+	private String getLobColumns() 
+	{
+		if (lobColNames_ == null)
+			return "";
+		StringBuilder colNames = new StringBuilder();
+		colNames.append(lobColNames_.get(0));
+		for (int i = 1; i < lobColNames_.size(); i++)
+			colNames.append(", ").append(lobColNames_.get(i));
+		return colNames.toString();
+	}
+
+	private void setLobLocators() throws SQLException 
+	{
+		if (lobLocators_.length != lobObjects_.size())
+			throw Messages.createSQLException(connection_.locale_, "lob_objects_and_locators_dont_match", null);
+		int lobLocatorIdx = 0;
+		for (SQLMXLob lobObject : lobObjects_) {
+			if (lobObject != null)
+				lobObject.setLobLocator(lobLocators_[lobLocatorIdx]);
+			lobLocatorIdx++;
+		}
+	}
+
+	private String[] getLobLocators() throws SQLException
+	{
+     	   SQLMXPreparedStatement lobLocatorStmt = null;
+	   SQLMXResultSet lobLocatorRS = null;
+	   int lBatchBindingSize = connection_.batchBindingSize_;
+	   try {
+		//String selectForLobLocator = "select " + getLobColumns() + " from ( " + this.sql_ + " ) as x";
+		String selectForLobLocator = "select * from ( " + this.sql_ + " ) as x";
+		connection_.batchBindingSize_ = paramRowCount_;
+		lobLocatorStmt = (SQLMXPreparedStatement)connection_.prepareStatement(selectForLobLocator);
+		lobLocatorStmt.copyParameters(this); 
+		if (paramRowCount_ == 0)
+			lobLocatorRS = (SQLMXResultSet)lobLocatorStmt.executeQuery();
+		else {
+			int[] batchRet = lobLocatorStmt.executeBatch();
+			lobLocatorRS = (SQLMXResultSet)lobLocatorStmt.getResultSet();
+		}
+		int numLocators = ((paramRowCount_ == 0 ? paramRowCount_ = 1 : paramRowCount_) * getNumLobColumns());
+		String lobLocators[] = new String[numLocators];
+		int locatorsIdx = 0;
+		while (lobLocatorRS.next()) {
+			for (int i = 0; i < getNumLobColumns() ; i++) {
+				if (locatorsIdx < lobLocators.length)
+					//lobLocators[locatorsIdx++] = lobLocatorRS.getString(i+1);
+					lobLocators[locatorsIdx++] = lobLocatorRS.getLobLocator(lobColIds_.get(i));
+				else
+					throw Messages.createSQLException(connection_.locale_, 
+						"locators out of space" , null);
+			}	
+		}
+		return lobLocators;
+	   } finally {
+		if (lobLocatorRS != null)
+			lobLocatorRS.close();
+		if (lobLocatorStmt != null)
+			lobLocatorStmt.close();
+		connection_.batchBindingSize_ = lBatchBindingSize;
+	   }
+	}
+
 //------------------------------
 }
diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSet.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSet.java
index 3ace978..6f0942c 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSet.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXResultSet.java
@@ -604,7 +604,7 @@
 		try {
 			int dataType;
 			Object x;
-			long data_locator;
+			String data_locator;
 			Blob data;
 			String tableName;
 
@@ -621,11 +621,15 @@
 			else {
 				if (x instanceof Blob)
 					data = (Blob) x;
-				else if (x instanceof Long) {
-					data_locator = ((Long) x).longValue();
-					tableName = outputDesc_[columnIndex - 1].tableName_;
-					data = new SQLMXBlob(connection_, tableName, data_locator);
-					row.setBlob(columnIndex, data);
+				else if (x instanceof String) {
+					data_locator = (String)x; 
+					data = new SQLMXBlob(connection_, data_locator);
+					row.setObject(columnIndex, data);
+					isAnyLob_ = true;
+				} else if (x instanceof byte[]) {
+					data_locator = new String((byte[])x);
+					data = new SQLMXBlob(connection_, data_locator);
+					row.setObject(columnIndex, data);
 					isAnyLob_ = true;
 				} else
 					throw Messages.createSQLException(connection_.locale_,
@@ -866,7 +870,7 @@
 			debug[methodId_getClob_I].methodEntry();
 		try {
 			int dataType;
-			long data_locator;
+			String  data_locator;
 			Clob data;
 			String tableName;
 
@@ -883,14 +887,19 @@
 			else {
 				if (x instanceof Clob)
 					data = (Clob) x;
-				else {
-					data_locator = row
-							.getLong(columnIndex, connection_.locale_);
-					tableName = outputDesc_[columnIndex - 1].tableName_;
-					data = new SQLMXClob(connection_, tableName, data_locator);
+				else if (x instanceof String) {
+					data_locator = (String) x;
+					data = new SQLMXClob(connection_, data_locator);
 					row.setObject(columnIndex, data);
 					isAnyLob_ = true;
-				}
+				} else if (x instanceof byte[]) {
+					data_locator = new String((byte[])x);
+					data = new SQLMXClob(connection_, data_locator);
+					row.setObject(columnIndex, data);
+					isAnyLob_ = true;
+				} else
+					throw Messages.createSQLException(connection_.locale_,
+							"restricted_data_type", null);
 			}
 			return data;
 		} finally {
@@ -1639,7 +1648,7 @@
 				// set name
 				charsetcode = outputDesc_[columnIndex - 1].sqlCharset_;
 				charsetname = SQLMXConnection.getCharsetEncodingCached(
-						connection_.server_, connection_.getDialogueId_(),
+						connection_.server_, connection_.getDialogueId(),
 						charsetcode, connection_.iso88591EncodingOverride_);
 				wasNull_ = false;
 				try {
@@ -1867,7 +1876,7 @@
 			}
 			// Context Handle and Statement ID
 			// Call to the C++ or JNI layer to retrieve ctxHandle and stmtID
-			getResultSetInfo(connection_.getDialogueId_(), stmtId_, retValue);
+			getResultSetInfo(connection_.getDialogueId(), stmtId_, retValue);
 			if (retValue.stmtClosed) {
 				retValue.RSClosed = retValue.stmtClosed;
 			}
@@ -2483,7 +2492,7 @@
 										"invalid_cursor_state", null);
 							}
 							validRow = fetchN(connection_.server_, connection_
-									.getDialogueId_(), connection_.getTxid_(),
+									.getDialogueId(), connection_.getTxid(),
 									connection_.transactionMode_, stmtId_,
 									maxRowCnt, queryTimeout, holdability_);
 						}// End sync
@@ -3588,15 +3597,15 @@
 							{
 								if ((stmt_.currentResultSetIndex_ == stmt_.resultSetIndex_)
 										&& (stmt_.spjRSCommitCount_ == 1)) {
-									txid = connection_.getTxid_();
+									txid = connection_.getTxid();
 									stmt_.spjRSCommitCount_--;
 								}
 							} else
-								txid = connection_.getTxid_();
+								txid = connection_.getTxid();
 						}
 						
 						close(connection_.server_,
-								connection_.getDialogueId_(), txid,
+								connection_.getDialogueId(), txid,
 								connection_.autoCommit_,
 								connection_.transactionMode_, stmtId_, dropStmt);
 
@@ -4230,7 +4239,7 @@
 			stmtId_ = stmtId;
 
 			// Check if the transaction is started by this Select statement
-			if (connection_.getTxid_() == 0 && txid != 0)
+			if (connection_.getTxid() == 0 && txid != 0)
 				txnStarted_ = true;
 			connection_.setTxid_(txid);
 			holdability_ = CLOSE_CURSORS_AT_COMMIT;
@@ -5104,5 +5113,33 @@
         row = (DataWrapper)cachedRows_.get(currentRow_ - 1);
         return row.getSQLBytes(columnIndex);
     }
+  
+    String getLobLocator(int columnIndex) throws SQLException 
+    {
+        Object x;
+        String data = null;
+
+        validateGetInvocation(columnIndex);
+        int dataType = outputDesc_[columnIndex - 1].dataType_;
+        if (dataType != Types.CLOB && dataType != Types.BLOB)
+           throw Messages.createSQLException(connection_.locale_, "restricted_data_type", null);
+        DataWrapper row = getCurrentRow();
+        wasNull_ = row.isNull(columnIndex);
+        if (wasNull_)
+           return null;
+        x = row.getObject(columnIndex);
+        wasNull_ = (x == null);
+        if (wasNull_)
+           data = null;
+        else {
+           if (x instanceof String) {
+               data = (String)x;
+           } else if (x instanceof byte[]) {
+               data = new String((byte[])x);
+           } 
+        }
+        return data;
+    }
+
 //--------------------------
 }
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 836a10f..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
@@ -47,13 +47,6 @@
 
 			if (batchCommands_ == null)
 				batchCommands_ = new ArrayList<String>();
-			// Scan the sql string for the special LOB EMPTY_CLOB() or
-			// EMPTY_BLOB()
-			// methods. This is required to replace the special method names in
-			// the sql string with a valid datalocator to insert for an empty
-			// row.
-			// SQL/MX does not know how to translate these special method names.
-			sql = scanSqlStr(sql);
 			batchCommands_.add(sql);
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -70,7 +63,7 @@
 			// and it is not yet seen by the application
 
 			synchronized (connection_) {
-				cancel(connection_.server_, connection_.getDialogueId_(), stmtId_);
+				cancel(connection_.server_, connection_.getDialogueId(), stmtId_);
 			}
 		} finally {
 			if (JdbcDebugCfg.entryActive)
@@ -143,8 +136,8 @@
 				beginTime=System.currentTimeMillis();
 				}
 				synchronized (connection_) {
-					executeDirect(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					executeDirect(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, getStmtLabel_(),
 							cursorName_, sql_.trim(), isSelect_, queryTimeout_,
 							resultSetHoldability_, resultSet_,this.stmtId_);
@@ -299,8 +292,8 @@
 				beginTime=System.currentTimeMillis();
 				}
 				synchronized (connection_) {
-					executeBatch(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					executeBatch(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, getStmtLabel_(),
 							cursorName_, batchCommands_.toArray(), isSelect_,
 							queryTimeout_, contBatchOnError,this.stmtId_);
@@ -393,8 +386,8 @@
 				beginTime=System.currentTimeMillis();
 				}
 				synchronized (connection_) {
-					executeDirect(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					executeDirect(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, getStmtLabel_(),
 							cursorName_, sql_.trim(), isSelect_, queryTimeout_,
 							resultSetHoldability_, resultSet_,this.stmtId_);
@@ -461,8 +454,8 @@
 				beginTime=System.currentTimeMillis();
 				}
 				synchronized (connection_) {
-					executeDirect(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					executeDirect(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, getStmtLabel_(),
 							cursorName_, sql_.trim(), isSelect_, queryTimeout_,
 							resultSetHoldability_, resultSet_,this.stmtId_);
@@ -690,7 +683,7 @@
 			if (JdbcDebugCfg.entryActive)
 				debug[methodId_getMoreResults_I]
 						.methodParameters("Pre-dialogueId_= "
-								+ connection_.getDialogueId_() + "  stmtId_= "
+								+ connection_.getDialogueId() + "  stmtId_= "
 								+ stmtId_ + "  resultSetMax_= " + resultSetMax_
 								+ "  resultSetIndex_= " + resultSetIndex_
 								+ "  isSPJResultSet_= " + isSPJResultSet_
@@ -699,8 +692,8 @@
 			// stmtLabel_ = ... append RSx to existing base RS stmtLabel_
 			SPJRSstmtLabel_ = SPJRSbaseStmtLabel_ + resultSetIndex_;
 
-			executeRS(connection_.server_, connection_.getDialogueId_(), connection_
-					.getTxid_(), connection_.autoCommit_,
+			executeRS(connection_.server_, connection_.getDialogueId(), connection_
+					.getTxid(), connection_.autoCommit_,
 					connection_.transactionMode_, getStmtLabel_(),
 					SPJRSstmtLabel_, isSelect_, stmtId_, resultSetIndex_,
 					resultSet_);
@@ -708,7 +701,7 @@
 			if (JdbcDebugCfg.entryActive)
 				debug[methodId_getMoreResults_I]
 						.methodParameters("Post-dialogueId_= "
-								+ connection_.getDialogueId_() + "  stmtId_= "
+								+ connection_.getDialogueId() + "  stmtId_= "
 								+ stmtId_ + "  resultSetMax_= " + resultSetMax_
 								+ "  resultSetIndex_= " + resultSetIndex_
 								+ "  isSPJResultSet_= " + isSPJResultSet_
@@ -775,7 +768,7 @@
 					if (JdbcDebugCfg.traceActive)
 						debug[methodId_getResultSet]
 								.methodParameters("Pre-dialogueId_= "
-										+ connection_.getDialogueId_()
+										+ connection_.getDialogueId()
 										+ "  stmtId_= " + stmtId_
 										+ "  resultSetMax_= " + resultSetMax_
 										+ "  resultSetIndex_= "
@@ -788,8 +781,8 @@
 					// to existing base SPJRS stmt label
 					SPJRSstmtLabel_ = SPJRSbaseStmtLabel_ + resultSetIndex_;
 
-					executeRS(connection_.server_, connection_.getDialogueId_(),
-							connection_.getTxid_(), connection_.autoCommit_,
+					executeRS(connection_.server_, connection_.getDialogueId(),
+							connection_.getTxid(), connection_.autoCommit_,
 							connection_.transactionMode_, getStmtLabel_(),
 							SPJRSstmtLabel_, isSelect_, stmtId_,
 							resultSetIndex_, resultSet_);
@@ -802,7 +795,7 @@
 					if (JdbcDebugCfg.traceActive)
 						debug[methodId_getResultSet]
 								.methodParameters("Post-dialogueId_= "
-										+ connection_.getDialogueId_()
+										+ connection_.getDialogueId()
 										+ "  stmtId_= " + stmtId_
 										+ "  resultSetMax_= " + resultSetMax_
 										+ "  resultSetIndex_= "
@@ -944,7 +937,7 @@
 
 				synchronized (connection_) {
 					// Pass the fetch size change to the driver
-					resetFetchSize(connection_.getDialogueId_(), stmtId_, fetchSize_);
+					resetFetchSize(connection_.getDialogueId(), stmtId_, fetchSize_);
 				}
 			}
 		} finally {
@@ -1062,83 +1055,13 @@
 		}
 	}
 
-	String scanSqlStr(String sql) throws SQLException {
-		if (JdbcDebugCfg.entryActive)
-			debug[methodId_scanSqlStr].methodEntry();
-		try {
-			String tempStr;
-			String tempSql;
-			int index = 0;
-			int oldIndex = 0;
-			StringBuffer newSql = null;
-			boolean clobFound = false;
-			boolean blobFound = false;
-			int len;
-
-			tempStr = sql.toUpperCase();
-			len = sql.length();
-			while (true) {
-				if ((index = tempStr.indexOf("EMPTY_CLOB()", oldIndex)) != -1) {
-					if (newSql == null)
-						newSql = new StringBuffer(len);
-					newSql.append(sql.substring(oldIndex, index));
-					newSql.append(Long.toString(connection_.getDataLocator(
-							connection_.clobTableName_, false)));
-					oldIndex = index + 12;
-					clobFound = true;
-				} else {
-					if (clobFound)
-						newSql.append(sql.substring(oldIndex));
-					break;
-				}
-			}
-			oldIndex = 0;
-			if (clobFound) {
-				tempSql = newSql.toString();
-				tempStr = tempSql.toUpperCase();
-			} else
-				tempSql = sql;
-
-			while (true) {
-				if ((index = tempStr.indexOf("EMPTY_BLOB()", oldIndex)) != -1) {
-					if (newSql == null) {
-						newSql = new StringBuffer(len);
-					} else {
-						if (!blobFound) // set the newSql to zero length for the
-							// first time
-							newSql.setLength(0);
-					}
-					newSql.append(tempSql.substring(oldIndex, index));
-					newSql.replace(index, index + 12, Long.toString(connection_
-							.getDataLocator(connection_.blobTableName_, true)));
-					blobFound = true;
-					oldIndex = index + 12;
-				} else {
-					if (blobFound)
-						newSql.append(tempSql.substring(oldIndex));
-					break;
-				}
-			}
-			if (clobFound || blobFound)
-				return newSql.toString();
-			else
-				return sql;
-		} finally {
-			if (JdbcDebugCfg.entryActive)
-				debug[methodId_scanSqlStr].methodExit();
-		}
-	}
-
 	void validateExecDirectInvocation(String sql) throws SQLException {
 		if (JdbcDebugCfg.entryActive)
 			debug[methodId_validateExecDirectInvocation_L].methodEntry();
 		try {
 			validateExecDirectInvocation();
 			isSelect_ = getStmtSqlType(sql);
-			sql_ = scanSqlStr(sql).trim();
-			if(SQLMXConnection.getSqlStmtType(sql) == SQLMXConnection.TYPE_CONTROL){
-				connection_.setOfCQDs.add(sql);
-			}
+			sql_ = sql;
 		} finally {
 			if (JdbcDebugCfg.entryActive)
 				debug[methodId_validateExecDirectInvocation_L].methodExit();
@@ -1176,11 +1099,11 @@
 			synchronized (connection_) {
 				if (!connection_.isClosed_) {
 					if (stmtId_ != 0)
-						close(connection_.server_, connection_.getDialogueId_(),
+						close(connection_.server_, connection_.getDialogueId(),
 								stmtId_, true);
 					else
 						closeUsingLabel(connection_.server_,
-								connection_.getDialogueId_(), getStmtLabel_(), true);
+								connection_.getDialogueId(), getStmtLabel_(), true);
 				}
 			}// End sync
 		} finally {
@@ -1207,7 +1130,7 @@
 				// reduced
 				connection_.addElement(this);
 				// Check if the transaction is started by this Select statement
-				if (connection_.getTxid_() == 0 && txid != 0)
+				if (connection_.getTxid() == 0 && txid != 0)
 					resultSet_.txnStarted_ = true;
 				rowCount_ = -1;
 			} else {
@@ -1256,7 +1179,7 @@
 
 				// Check if the transaction is started by this Select statement
 				// if (connection_.txid_ == 0 && txid != 0) 
-				if (connection_.getTxid_() == txid) 
+				if (connection_.getTxid() == txid) 
 					resultSet_.txnStarted_ = true;
 				rowCount_ = -1;
 			} else {
@@ -1346,7 +1269,7 @@
 			if (JdbcDebugCfg.traceActive)
 				debug[methodId_firstResultSetExists]
 						.methodParameters("Pre-dialogueId_= "
-								+ connection_.getDialogueId_() + "  stmtId_= "
+								+ connection_.getDialogueId() + "  stmtId_= "
 								+ stmtId_ + "  resultSetMax_= " + resultSetMax_
 								+ "  resultSetIndex_= " + resultSetIndex_
 								+ "  isSPJResultSet_= " + isSPJResultSet_
@@ -1355,8 +1278,8 @@
 			// stmtLabel_ = ... append RSx to existing base RS stmtLabel_
 			SPJRSstmtLabel_ = SPJRSbaseStmtLabel_ + resultSetIndex_;
 
-			executeRS(connection_.server_, connection_.getDialogueId_(), connection_
-					.getTxid_(), connection_.autoCommit_,
+			executeRS(connection_.server_, connection_.getDialogueId(), connection_
+					.getTxid(), connection_.autoCommit_,
 					connection_.transactionMode_, getStmtLabel_(),
 					SPJRSstmtLabel_, isSelect_, stmtId_, resultSetIndex_,
 					resultSet_);
@@ -1364,7 +1287,7 @@
 			if (JdbcDebugCfg.traceActive)
 				debug[methodId_firstResultSetExists]
 						.methodParameters("Post-dialogueId_= "
-								+ connection_.getDialogueId_() + "  stmtId_= "
+								+ connection_.getDialogueId() + "  stmtId_= "
 								+ stmtId_ + "  resultSetMax_= " + resultSetMax_
 								+ "  resultSetIndex_= " + resultSetIndex_
 								+ "  isSPJResultSet_= " + isSPJResultSet_
@@ -1629,7 +1552,6 @@
 	private static int methodId_setMaxRows = 33;
 	private static int methodId_setQueryTimeout = 34;
 	private static int methodId_getStmtSqlType = 35;
-	private static int methodId_scanSqlStr = 36;
 	private static int methodId_validateExecDirectInvocation_L = 37;
 	private static int methodId_validateExecDirectInvocation_V = 38;
 	private static int methodId_internalClose = 39;
@@ -1713,7 +1635,6 @@
 					"setQueryTimeout");
 			debug[methodId_getStmtSqlType] = new JdbcDebug(className,
 					"getStmtSqlType");
-			debug[methodId_scanSqlStr] = new JdbcDebug(className, "scanSqlStr");
 			debug[methodId_validateExecDirectInvocation_L] = new JdbcDebug(
 					className, "validateExecDirectInvocation[L]");
 			debug[methodId_validateExecDirectInvocation_V] = new JdbcDebug(
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 1555167..cf20ee1 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
@@ -118,11 +118,9 @@
 					// unique key is created
 					// RFE: Batch update improvements
 					key = getLanguage() + delimiter + getCatalog() + delimiter + getSchema()
-							+ delimiter + getMploc() + delimiter + getSqlmx_nowait()
 							+ delimiter + getBatchBinding() + delimiter
 							+ getMaxPoolSize() + delimiter + getMinPoolSize() + delimiter
 							+ getMaxStatements() + delimiter + getTraceFlag() + delimiter
-							+ getBlobTableName() + delimiter + getClobTableName()
 							+ delimiter + getTransactionMode() + delimiter
 							+ getIso88591EncodingOverride() + delimiter
 							+ getContBatchOnError();
@@ -287,11 +285,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);
 
 	native static void setDefaultEncoding(String encoding);
 
@@ -370,7 +366,7 @@
 		checkLibraryVersion(DriverInfo.driverVproc);
 		
 		// Initialize Java objects, methods references into gJNICache
-		SQLMXInitialize(locale_.getLanguage(), 1, "OFF", null);
+		SQLMXInitialize(locale_.getLanguage());
 		
     	// 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 49223aa..f2f08a6 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
@@ -43,13 +43,11 @@
 
     private String catalog_;
     private String schema_;
-    private String mploc_;
     private int batchBindingSize_;
-    private int sql_nowait;
     private int traceFlag_;
     private String traceFile_;
-    private String clobTableName_;
-    private String blobTableName_;
+    private int inlineLobChunkSize_;
+    private int lobChunkSize_; 
     private int transactionMode_;
     private String iso88591EncodingOverride_;
     private String stmtatomicity_;
@@ -79,10 +77,6 @@
     private int maxIdleTime_;
     private int maxStatements_;
 
-    //MFC
-    private String enableMFC_;
-    private String compiledModuleLocation_;
-
     private String externalCallHandler = "NONE";
     private String externalCallPrefix = "EXT";
 
@@ -167,20 +161,6 @@
     }
 
     /**
-     * @return the mploc_
-     */
-    public String getMploc() {
-        return mploc_;
-    }
-
-    /**
-     * @param mploc_ the mploc_ to set
-     */
-    public void setMploc(String mploc_) {
-        this.mploc_ = mploc_;
-    }
-
-    /**
      * @return the batchBindingSize_
      */
     public int getBatchBinding() {
@@ -220,31 +200,6 @@
     }
 
 
-
-    /**
-     * @return the sql_nowait
-     */
-    public int getSqlmx_nowait() {
-        return sql_nowait;
-    }
-
-    /**
-     * @param sql_nowait the sql_nowait to set
-     */
-    public void setSqlmx_nowait(String nowaitFlag) {
-        if (nowaitFlag == null)
-            this.sql_nowait = 1;
-        else {
-            if (nowaitFlag.equalsIgnoreCase("off") || nowaitFlag.equals("0")) //when setSqlmx_nowait called with zero
-                this.sql_nowait = 0;
-            else if (nowaitFlag.equalsIgnoreCase("on_olt_off")|| nowaitFlag.equals("2"))
-                this.sql_nowait = 2;
-            else
-                this.sql_nowait = 1;
-        }
-//		this.sql_nowait = sql_nowait;
-    }
-
     /**
      * @return the traceFlag_
      */
@@ -304,32 +259,38 @@
         }
     }
 
-    /**
-     * @return the clobTableName_
-     */
-    public String getClobTableName() {
-        return clobTableName_;
+    public int getInlineLobChunkSize()
+    {
+       return inlineLobChunkSize_;
     }
 
-    /**
-     * @param clobTableName_ the clobTableName_ to set
-     */
-    public void setClobTableName(String clobTableName_) {
-        this.clobTableName_ = clobTableName_;
+    public void setInlineLobChunkSize(int size)
+    {
+       inlineLobChunkSize_ = size;       
     }
 
-    /**
-     * @return the blobTableName_
-     */
-    public String getBlobTableName() {
-        return blobTableName_;
+    public void setInlineLobChunkSize(String sz) {
+       int size = 0;
+       if (sz !=  null) 
+          size = Integer.parseInt(sz);
+       setInlineLobChunkSize(size);
     }
 
-    /**
-     * @param blobTableName_ the blobTableName_ to set
-     */
-    public void setBlobTableName(String blobTableName_) {
-        this.blobTableName_ = blobTableName_;
+    public int getLobChunkSize()
+    {
+        return lobChunkSize_;
+    }
+
+    public void setLobChunkSize(int size)
+    {
+       lobChunkSize_ = size;       
+    }
+
+    public void setLobChunkSize(String sz) {
+       int size = 0;
+       if (sz !=  null) 
+          size = Integer.parseInt(sz);
+       setLobChunkSize(size);
     }
 
     /**
@@ -655,39 +616,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
@@ -945,6 +873,8 @@
 
     void initialize(Properties props) {
         inprops_ = props;
+        inlineLobChunkSize_ = 16*1024;
+        lobChunkSize_ = 16*1024*1024;
         setProperties();
     }
 
@@ -1012,8 +942,6 @@
         setSchema(getProperty("schema"));
         setBatchBinding(getProperty("batchBinding"));
         setLanguage(getProperty("language"));
-        setMploc(getProperty("mploc"));
-        setSqlmx_nowait(getProperty("sql_nowait"));
         setSpjrs(getProperty("Spjrs"));
         setStmtatomicity(getProperty("stmtatomicity"));
 //		setStmtatomicityval(getProperty(""));
@@ -1026,13 +954,8 @@
         setMaxStatements(getProperty("maxStatements"));
         setMinPoolSize(getProperty("minPoolSize"));
         setInitialPoolSize(getProperty("initialPoolSize"));
-
-        setBlobTableName(getProperty("blobTableName"));
-        setClobTableName(getProperty("clobTableName"));
-
-        setEnableMFC(getProperty("enableMFC"));
-        setCompiledModuleLocation(getProperty("compiledModuleLocation"));
-
+	setInlineLobChunkSize(getProperty("inlineLobChunkSize"));
+	setLobChunkSize(getProperty("lobChunkSize"));
 
 //		setContBatchOnErrorval(getProperty(""));
 
@@ -1064,10 +987,6 @@
             props.setProperty("schema", schema_);
 
         props.setProperty("batchBinding", String.valueOf(batchBindingSize_));
-        if (getMploc() != null)
-            props.setProperty("mploc", mploc_);
-
-        props.setProperty("sql_nowait", String.valueOf(sql_nowait));
         if (getSpjrs() != null)
             props.setProperty("Spjrs", Spjrs_);
 
@@ -1085,15 +1004,8 @@
         props.setProperty("maxStatements", String.valueOf(maxStatements_));
         props.setProperty("minPoolSize", String.valueOf(minPoolSize_));
         props.setProperty("initialPoolSize", String.valueOf(initialPoolSize_));
-
-        if (getBlobTableName() != null)
-            props.setProperty("blobTableName", blobTableName_);
-        if (getClobTableName() != null)
-            props.setProperty("clobTableName", clobTableName_);
-        if (getEnableMFC() != null)
-            props.setProperty("enableMFC", enableMFC_);
-        if (getCompiledModuleLocation() != null)
-            props.setProperty("compiledModuleLocation", compiledModuleLocation_);
+ 	props.setProperty("inlineLobChunkSize", String.valueOf(inlineLobChunkSize_));
+ 	props.setProperty("lobChunkSize", String.valueOf(lobChunkSize_));
 
         // props.setProperty("",);
         // props.setProperty("enableLog",);
@@ -1144,11 +1056,6 @@
         propertyInfo[i].description = "Specifies that statements are batched together in the executeBatch() operation.";
         propertyInfo[i++].choices = null;
 
-        propertyInfo[i] = new java.sql.DriverPropertyInfo("mploc",
-                mploc_);
-        propertyInfo[i].description = "Specifies the Guardian location in which SQL tables are created.";
-        propertyInfo[i++].choices = null;
-
         propertyInfo[i] = new java.sql.DriverPropertyInfo(
                 "maxPoolSize", Integer.toString(maxPoolSize_));
         propertyInfo[i].description = "Sets the maximum number of physical connections that the pool can contain.";
@@ -1185,13 +1092,13 @@
         propertyInfo[i++].choices = null;
 
         propertyInfo[i] = new java.sql.DriverPropertyInfo(
-                "clobTableName", clobTableName_);
-        propertyInfo[i].description = "Specifies the LOB table for using CLOB columns.";
+                "inlineLobChunkSize", Integer.toString(inlineLobChunkSize_));
+        propertyInfo[i].description = "Specifies the LOB chunk size that can be inlined along with row.";
         propertyInfo[i++].choices = null;
 
         propertyInfo[i] = new java.sql.DriverPropertyInfo(
-                "blobTableName", blobTableName_);
-        propertyInfo[i].description = "Specifies the LOB table for using BLOB columns.";
+                "lobChunkSize", Integer.toString(lobChunkSize_));
+        propertyInfo[i].description = "Specifies the LOB chunk size for streaming.";
         propertyInfo[i++].choices = null;
 
         propertyInfo[i] = new java.sql.DriverPropertyInfo(
@@ -1228,13 +1135,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;
@@ -1243,14 +1143,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";
@@ -1294,7 +1186,6 @@
         ref.add(new StringRefAddr("catalog", getCatalog()));
         ref.add(new StringRefAddr("schema", getSchema()));
         ref.add(new StringRefAddr("language", getLanguage()));
-        ref.add(new StringRefAddr("mploc", getMploc()));
         /* Description: Adding the reference to ISO88591 encoding */
         ref.add(new StringRefAddr("ISO88591", getIso88591EncodingOverride()));
         ref.add(new StringRefAddr("batchBinding", Integer
@@ -1311,13 +1202,12 @@
                 .toString(getMaxIdleTime())));
 //		ref.add(new StringRefAddr("propertyCycle", Integer
 //				.toString(propertyCycle_)));
-        ref.add(new StringRefAddr("clobTableName", getClobTableName()));
-        ref.add(new StringRefAddr("blobTableName", getBlobTableName()));
+        ref.add(new StringRefAddr("inlineLobChunkSize", Integer
+                .toString(getInlineLobChunkSize())));
+        ref.add(new StringRefAddr("lobChunkSize", Integer
+                .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/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/TConnection.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/TConnection.java
index 2ef22da..f933e74 100644
--- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/TConnection.java
+++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/TConnection.java
@@ -460,35 +460,6 @@
 		connection_.setTypeMap(map);
 	}
 
-	public PreparedStatement cpqPrepareStatement(String moduleName,
-			int moduleVersion, long moduleTimestamp, String stmtName,
-			boolean isSelect) throws SQLException {
-		PreparedStatement stmt;
-
-		if (out_ != null) {
-			out_.println(getTraceId() + "cpqPrepareStatement(\"" + moduleName
-					+ "\"," + moduleTimestamp + ", \"" + stmtName + "\", \""
-					+ isSelect + ")");
-		}
-
-		if (connection_ instanceof org.apache.trafodion.jdbc.t2.SQLMXConnection) {
-			stmt = ((org.apache.trafodion.jdbc.t2.SQLMXConnection) connection_)
-					.cpqPrepareStatement(moduleName, moduleVersion,
-							moduleTimestamp, stmtName, isSelect);
-		} else {
-			stmt = null;
-		}
-
-		if (out_ != null) {
-			out_.println(getTraceId() + "cpqPrepareStatement(\"" + moduleName
-					+ "\"," + moduleTimestamp + ", \"" + stmtName + "\", \""
-					+ isSelect + ") returns PreparedStatement ["
-					+ ((SQLMXStatement)((TPreparedStatement)stmt).stmt_).getStmtLabel_() + "]");
-		}
-
-		return new TPreparedStatement(stmt, out_);
-	}
-
 	// Constructors with access specifier as "default"
 	public TConnection(Connection connection, PrintWriter out)
 			throws SQLException {
diff --git a/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp b/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
index 6c18e40..01efdf2 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
@@ -6308,6 +6308,7 @@
 									stmtLabel,
 									sqlString,
 									holdableCursor,
+									queryTimeout,			
 									&returnCode,
 									&sqlWarningOrErrorLength,
 									sqlWarningOrError,
@@ -6350,6 +6351,7 @@
 									stmtLabel,
 									sqlString,
 									holdableCursor,
+									queryTimeout,
 									&returnCode,
 									&sqlWarningOrErrorLength,
 									sqlWarningOrError,
@@ -6897,6 +6899,7 @@
 											stmtLabel,
 											sqlString,
 											holdableCursor,
+											queryTimeout,
 											&returnCode,
 											&sqlWarningOrErrorLength,
 											sqlWarningOrError,
@@ -6981,6 +6984,7 @@
 					stmtLabel,
 					sqlString,
 					holdableCursor,
+					queryTimeout,
 					&returnCode,
 					&sqlWarningOrErrorLength,
 					sqlWarningOrError,
diff --git a/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp b/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp
index c23406f..83e2fa5 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp
@@ -257,15 +257,15 @@
         if (getenv("TRAF_MULTIPLE_SQL_LOG_FILE"))
            singleSqlLogFile = FALSE;
         if (singleSqlLogFile) {
-	   sprintf( logNameSuffix, "_%d.log", myNid );
            lv_configFileName = "log4cxx.trafodion.sql.config";
+	   CommonLogger::instance().initLog4cxx(lv_configFileName);
         }
         else 
         {
 	   sprintf( logNameSuffix, "_%d_%d.log", myNid, myPid );
            lv_configFileName = "log4cxx.trafodion.masterexe.config";
+	   CommonLogger::instance().initLog4cxx(lv_configFileName, logNameSuffix);
         }
-	CommonLogger::instance().initLog4cxx(lv_configFileName, logNameSuffix);
 
     if(retcode == FALSE )
    {
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h b/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h
index ab344df..ed5650a 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h
@@ -202,6 +202,7 @@
   , /* In    */ const IDL_char *stmtLabel
   , /* In    */ IDL_string sqlString
   , /* In    */ IDL_long holdableCursor
+  , /* In    */ Int32 queryTimeout
   , /* Out   */ IDL_long *returnCode
   , /* Out   */ IDL_long *sqlWarningOrErrorLength
   , /* Out   */ BYTE *&sqlWarningOrError
@@ -371,10 +372,11 @@
 extern "C" void 
 rePrepare2( SRVR_STMT_HDL *pSrvrStmt
           , Int32           sqlStmtType
-	      , Int32           inputRowCnt
-       	  , Int32			holdableCursor
-	      , SQLRETURN     	*rc 
-	      , Int32          	*returnCode
+	  , Int32           inputRowCnt
+       	  , Int32    	    holdableCursor
+          , Int32 	    queryTimeout
+	  , SQLRETURN     	*rc 
+	  , Int32          	*returnCode
           , Int32      		*sqlWarningOrErrorLength
           , BYTE          	*&sqlWarningOrError );
 
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
index a1edb85..d1aa821 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
@@ -832,6 +832,7 @@
   , /* In    */ const IDL_char *stmtLabel
   , /* In    */ IDL_string sqlString
   , /* In    */ Int32 holdableCursor
+  , /* In    */ Int32 queryTimeout
   , /* Out   */ Int32 *returnCode
   , /* Out   */ Int32 *sqlWarningOrErrorLength
   , /* Out   */ BYTE *&sqlWarningOrError
@@ -1410,6 +1411,7 @@
 				  , sqlStmtType
 				  , inputRowCnt
 				  , holdableCursor
+                                  , queryTimeout
 				  , &rc
 				  , returnCode
 				  , sqlWarningOrErrorLength
@@ -1746,6 +1748,7 @@
 				  , sqlStmtType
 				  , inputRowCnt
 				  , holdableCursor
+				  , queryTimeout
 				  ,&rc
 				  , returnCode
 				  , sqlWarningOrErrorLength
@@ -2075,6 +2078,7 @@
 			, Int32			sqlStmtType
 			, Int32			inputRowCnt
 			, Int32		holdableCursor
+			, Int32 queryTimeout
 			, SQLRETURN     *rc
 			, Int32          *returnCode
 			, Int32      *sqlWarningOrErrorLength
diff --git a/core/sqf/conf/log4cxx.trafodion.auth.config b/core/sqf/conf/log4cxx.trafodion.auth.config
index ae8e5c9..c7181d4 100644
--- a/core/sqf/conf/log4cxx.trafodion.auth.config
+++ b/core/sqf/conf/log4cxx.trafodion.auth.config
@@ -24,7 +24,7 @@
 # Define some default values that can be overridden by system properties
 trafodion.root.logger=INFO, authAppender
 trafodion.log.dir=${TRAF_LOG}
-trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
+trafodion.log.filename.suffix=${HOSTNAME}
 
 # Define the root logger to the system property "trafodion.root.logger".
 log4j.rootLogger=${trafodion.root.logger}
@@ -36,7 +36,7 @@
 # Daily Rolling File Appender
 #
 log4j.appender.authAppender=org.apache.log4j.RollingFileAppender
-log4j.appender.authAppender.file=${trafodion.log.dir}/dbsecurity${trafodion.log.filename.suffix}
+log4j.appender.authAppender.file=${trafodion.log.dir}/dbsecurity.${trafodion.log.filename.suffix}.log
 log4j.appender.authAppender.maxFileSize=100000000
 log4j.appender.authAppender.maxBackupIndex=1
 log4j.appender.authAppender.addPid=false
diff --git a/core/sqf/conf/log4cxx.trafodion.sql.config b/core/sqf/conf/log4cxx.trafodion.sql.config
index a6f9e11..e55fdcf 100644
--- a/core/sqf/conf/log4cxx.trafodion.sql.config
+++ b/core/sqf/conf/log4cxx.trafodion.sql.config
@@ -23,7 +23,7 @@
 
 # Define some default values that can be overridden by system properties
 trafodion.log.dir=${TRAF_LOG}
-trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
+trafodion.log.filename.suffix=${HOSTNAME}
 
 # Logging Threshold
 log4j.threshhold=ALL
@@ -31,7 +31,7 @@
 # Rolling File Appender
 #
 log4j.appender.sqlAppender=org.apache.log4j.RollingFileAppender
-log4j.appender.sqlAppender.file=${trafodion.log.dir}/trafodion.sql${trafodion.log.filename.suffix}
+log4j.appender.sqlAppender.file=${trafodion.log.dir}/trafodion.sql.${trafodion.log.filename.suffix}.log
 log4j.appender.sqlAppender.maxFileSize=100000000
 log4j.appender.sqlAppender.maxBackupIndex=1
 log4j.appender.sqlAppender.addPid=false
@@ -40,7 +40,7 @@
 log4j.appender.sqlAppender.immediateFlush=true
 log4j.additive.sqlAppender=false 
 
-log4j.logger.MXOSRVR=ERROR,sqlAppender
+log4j.logger.MXOSRVR=WARN,sqlAppender
 
 # SQL
 log4j.logger.SQL=INFO,sqlAppender
diff --git a/core/sqf/conf/log4cxx.trafodion.sscp.config b/core/sqf/conf/log4cxx.trafodion.sscp.config
index 2308bed..34ccde0 100644
--- a/core/sqf/conf/log4cxx.trafodion.sscp.config
+++ b/core/sqf/conf/log4cxx.trafodion.sscp.config
@@ -23,7 +23,7 @@
 
 # Define some default values that can be overridden by system properties
 trafodion.log.dir=${TRAF_LOG}
-trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
+trafodion.log.filename.suffix=${HOSTNAME}
 
 # Logging Threshold
 log4j.threshhold=ALL
@@ -31,7 +31,7 @@
 # Rolling File Appender
 #
 log4j.appender.sscpAppender=org.apache.log4j.RollingFileAppender
-log4j.appender.sscpAppender.file=${trafodion.log.dir}/sscp${trafodion.log.filename.suffix}
+log4j.appender.sscpAppender.file=${trafodion.log.dir}/sscp.${trafodion.log.filename.suffix}.log
 log4j.appender.sscpAppender.maxFileSize=100000000
 log4j.appender.sscpAppender.maxBackupIndex=1
 log4j.appender.sscpAppender.addPid=false
diff --git a/core/sqf/conf/log4cxx.trafodion.ssmp.config b/core/sqf/conf/log4cxx.trafodion.ssmp.config
index e0ec9dc..512ce14 100644
--- a/core/sqf/conf/log4cxx.trafodion.ssmp.config
+++ b/core/sqf/conf/log4cxx.trafodion.ssmp.config
@@ -23,7 +23,7 @@
 
 # Define some default values that can be overridden by system properties
 trafodion.log.dir=${TRAF_LOG}
-trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
+trafodion.log.filename.suffix=${HOSTNAME}
 
 # Logging Threshold
 log4j.threshhold=ALL
@@ -31,7 +31,7 @@
 # Rolling File Appender
 #
 log4j.appender.ssmpAppender=org.apache.log4j.RollingFileAppender
-log4j.appender.ssmpAppender.file=${trafodion.log.dir}/ssmp${trafodion.log.filename.suffix}
+log4j.appender.ssmpAppender.file=${trafodion.log.dir}/ssmp.${trafodion.log.filename.suffix}.log
 log4j.appender.ssmpAppender.maxFileSize=100000000
 log4j.appender.ssmpAppender.maxBackupIndex=1
 log4j.appender.ssmpAppender.addPid=false
diff --git a/core/sqf/conf/log4cxx.trafodion.tm.config b/core/sqf/conf/log4cxx.trafodion.tm.config
index 5e99afb..fc482d1 100644
--- a/core/sqf/conf/log4cxx.trafodion.tm.config
+++ b/core/sqf/conf/log4cxx.trafodion.tm.config
@@ -23,7 +23,7 @@
 
 # Define some default values that can be overridden by system properties
 trafodion.log.dir=${TRAF_LOG}
-trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
+trafodion.log.filename.suffix=${HOSTNAME}
 
 # Logging Threshold
 log4j.threshhold=ALL
@@ -31,7 +31,7 @@
 # Rolling File Appender
 #
 log4j.appender.tmAppender=org.apache.log4j.RollingFileAppender
-log4j.appender.tmAppender.file=${trafodion.log.dir}/tm${trafodion.log.filename.suffix}
+log4j.appender.tmAppender.file=${trafodion.log.dir}/tm.${trafodion.log.filename.suffix}.log
 log4j.appender.tmAppender.maxFileSize=100000000
 log4j.appender.tmAppender.maxBackupIndex=1
 log4j.appender.tmAppender.addPid=false
diff --git a/core/sqf/conf/log4j.dtm.config b/core/sqf/conf/log4j.dtm.config
index d4247c1..d605167 100644
--- a/core/sqf/conf/log4j.dtm.config
+++ b/core/sqf/conf/log4j.dtm.config
@@ -23,7 +23,7 @@
 
 # Define some default values that can be overridden by system properties
 dtm.log.dir=${TRAF_LOG}
-dtm.log.file=trafodion.dtm.log
+dtm.log.file=trafodion.dtm.${hostName}.log
 
 # Logging Threshold
 log4j.threshhold=ALL
diff --git a/core/sqf/conf/log4j.sql.config b/core/sqf/conf/log4j.sql.config
index 6b2ed43..a859313 100644
--- a/core/sqf/conf/log4j.sql.config
+++ b/core/sqf/conf/log4j.sql.config
@@ -22,7 +22,8 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.sql.log=${TRAF_LOG}/trafodion.sql.java.log
+sql.log.dir=${TRAF_LOG}
+sql.log.file=trafodion.sql.java.${hostName}.log
 
 # Logging Threshold
 log4j.threshhold=ALL
@@ -30,7 +31,7 @@
 # Rolling File Appender
 #
 log4j.appender.sqlAppender=org.apache.log4j.RollingFileAppender
-log4j.appender.sqlAppender.file=${trafodion.sql.log}
+log4j.appender.sqlAppender.file=${sql.log.dir}/${sql.log.file}
 log4j.appender.sqlAppender.layout=org.apache.log4j.PatternLayout
 log4j.appender.sqlAppender.layout.ConversionPattern=%d{ISO8601} %p %c{2}: %m%n
 log4j.appender.sqlAppender.immediateFlush=true
diff --git a/core/sqf/monitor/linux/monlogging.cxx b/core/sqf/monitor/linux/monlogging.cxx
index 42adff1..412a4e8 100644
--- a/core/sqf/monitor/linux/monlogging.cxx
+++ b/core/sqf/monitor/linux/monlogging.cxx
@@ -141,7 +141,7 @@
     logFileType_ = SBX_LOG_TYPE_LOGFILE;
 
     // Log4cxx logging
-    char   hostname[MAX_PROCESSOR_NAME] = {'\0'};
+    char   hostname[MAX_PROCESSOR_NAME + 1 ] = {'\0'};
     gethostname(hostname, MAX_PROCESSOR_NAME);
     char   logFileSuffix[MAX_FILE_NAME];
 
diff --git a/core/sqf/monitor/linux/process.cxx b/core/sqf/monitor/linux/process.cxx
index e2ebc58..6b202f1 100644
--- a/core/sqf/monitor/linux/process.cxx
+++ b/core/sqf/monitor/linux/process.cxx
@@ -1993,6 +1993,13 @@
     {
         trafVar_ = env ;
     }
+    static char   lv_hostname[MAX_PROCESSOR_NAME + 1 ] = {'\0'};
+    static bool   lv_hostname_obtained = false;
+    if ( ! lv_hostname_obtained ) {
+      gethostname(lv_hostname, MAX_PROCESSOR_NAME);
+      lv_hostname_obtained = true;
+    } 
+    hostNameVar_ = lv_hostname;
 
     // setup default environment variables from monitor or last CreateProcess call
     if (maxClientBuffers)
@@ -2067,6 +2074,7 @@
     setEnvStrVal ( childEnv, nextEnv, "TRAF_HOME", trafHome_.c_str() );
     setEnvStrVal ( childEnv, nextEnv, "TRAF_LOG", trafLog_.c_str() );
     setEnvStrVal ( childEnv, nextEnv, "TRAF_VAR", trafVar_.c_str() );
+    setEnvStrVal ( childEnv, nextEnv, "HOSTNAME", hostNameVar_.c_str() );
     setEnvStrVal ( childEnv, nextEnv, "USER", user );
     setEnvStrVal ( childEnv, nextEnv, "HOME", home );
     setEnvStrVal ( childEnv, nextEnv, "TERM", term );
diff --git a/core/sqf/monitor/linux/process.h b/core/sqf/monitor/linux/process.h
index 0f827b8..7178a19 100644
--- a/core/sqf/monitor/linux/process.h
+++ b/core/sqf/monitor/linux/process.h
@@ -542,6 +542,7 @@
     string       trafHome_;     // TRAF_HOME passed to object file
     string       trafLog_;      // TRAF_LOG passed to object file
     string       trafVar_;      // TRAF_VAR passed to object file
+    string       hostNameVar_;  // HOSTNAME passed to object file
 
     string       infile_;    // process's stdin
     string       outfile_;   // process's stdout
diff --git a/core/sqf/sqenvcom.sh b/core/sqf/sqenvcom.sh
index feda6fb..fcfc5b9 100644
--- a/core/sqf/sqenvcom.sh
+++ b/core/sqf/sqenvcom.sh
@@ -139,6 +139,7 @@
 export PDCP="$SQ_PDCP -R ssh"
 export TAR_DOWNLOAD_ROOT=$HOME/sqllogs
 export CACERTS_DIR=$HOME/cacerts
+export HOSTNAME
 
 # Get redhat major version
 # Examples:
diff --git a/core/sqf/sql/scripts/genms b/core/sqf/sql/scripts/genms
index 58beebb..cbb5ed3 100755
--- a/core/sqf/sql/scripts/genms
+++ b/core/sqf/sql/scripts/genms
@@ -208,6 +208,9 @@
    echo "RMS_SHARED_SEG_SIZE_MB=$RMS_SHARED_SEG_SIZE_MB"
 fi
 
+echo "#### Ignore ENOENT from epoll_ctl"
+echo "SQ_SB_IGNORE_ENOENT=1"
+
 echo ""
 echo ""
 echo "# Added by gensq.pl"
diff --git a/core/sqf/sql/scripts/sqgen b/core/sqf/sql/scripts/sqgen
index 12ceb1e..bc3c943 100755
--- a/core/sqf/sql/scripts/sqgen
+++ b/core/sqf/sql/scripts/sqgen
@@ -219,6 +219,11 @@
     
         echo "$PDSH $ExNodeList mkdir -p $MPI_TMPDIR/tmp "
         $PDSH $ExNodeList mkdir -p $MPI_TMPDIR/tmp
+
+        if [[ -f $TRAF_CONF/ms.env.add ]]; then
+           echo "$PDCP $ExNodeList $TRAF_CONF/ms.env.add  $TRAF_CONF "
+           $PDCP $ExNodeList $TRAF_CONF/ms.env.add $TRAF_CONF
+        fi
     
     fi
 fi
@@ -259,28 +264,24 @@
     exit $sq_stat;
 fi
 
+if [[ -f $TRAF_CONF/ms.env.add ]]
+then
+   cat $TRAF_CONF/ms.env.add >> $TRAF_VAR/ms.env
+fi
+
+
 sq_seamonster=$SQ_SEAMONSTER
 if [ -f $SQESPENV_FILE ]; then
     if [[ $sq_seamonster == 1 ]]; then 
         echo
         echo "Enabling tdm_arkesp.env file in $TRAF_VAR/ms.env"
-        echo "cat $TRAF_VAR/ms.env | sed -e "s@^# SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@" > $TRAF_VAR/ms.env.TEMP"
-        if [ -f $TRAF_VAR/ms.env.TEMP ]; then
-            rm $TRAF_VAR/ms.env.TEMP
-        fi
-        cat $TRAF_VAR/ms.env | sed -e "s@^# SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@" > $TRAF_VAR/ms.env.TEMP
-        cp $TRAF_VAR/ms.env.TEMP $TRAF_VAR/ms.env
-        rm $TRAF_VAR/ms.env.TEMP
+        sed -i "s@^# SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@" $TRAF_VAR/ms.env
+        sed -i "s@^# SQ_PROPS_TDM_ARKCMP=tdm_arkcmp.env@SQ_PROPS_TDM_ARKCMP=tdm_arkcmp.env@" $TRAF_VAR/ms.env
     else
         echo
         echo "Disabling tdm_arkesp.env file in $TRAF_VAR/ms.env"
-        echo "cat $TRAF_VAR/ms.env | sed -e "s@^SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@# SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@" > $TRAF_VAR/ms.env.TEMP"
-        if [ -f $TRAF_VAR/ms.env.TEMP ]; then
-            rm $TRAF_VAR/ms.env.TEMP
-        fi
-        cat $TRAF_VAR/ms.env | sed -e "s@^SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@# SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@" > $TRAF_VAR/ms.env.TEMP
-        cp $TRAF_VAR/ms.env.TEMP $TRAF_VAR/ms.env
-        rm $TRAF_VAR/ms.env.TEMP
+        sed -i "s@^SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@# SQ_PROPS_TDM_ARKESP=tdm_arkesp.env@" $TRAF_VAR/ms.env
+        sed -i "s@^SQ_PROPS_TDM_ARKCMP=tdm_arkcmp.env@# SQ_PROPS_TDM_ARKCMP=tdm_arkcmp.env@" $TRAF_VAR/ms.env
     fi
 fi
 
@@ -288,10 +289,6 @@
 if [[ -z ${TRAF_AGENT} ]]; then
     if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then    
         echo
-        echo
-        echo "Copying the configuration and generated files to all the nodes in the cluster"
-        echo
-
         echo "Copying $TRAF_VAR/ms.env to $TRAF_VAR to all the nodes"
         echo "$PDCP $ExNodeList $TRAF_VAR/ms.env   $TRAF_VAR "
         $PDCP $ExNodeList $TRAF_VAR/ms.env   $TRAF_VAR
@@ -300,11 +297,12 @@
         echo "$PDCP $ExNodeList $SQCONFIG_FILE $SQCONFIG_PERSIST_FILE    $TRAF_CONF "
         $PDCP $ExNodeList $SQCONFIG_FILE $SQCONFIG_PERSIST_FILE    $TRAF_CONF
 
-
-        echo
-        echo "Copying $TRAF_VAR/seamonster.env to $TRAF_VAR to all the nodes"
-        echo "$PDCP $ExNodeList $TRAF_VAR/seamonster.env   $TRAF_VAR "
-        $PDCP $ExNodeList $TRAF_VAR/seamonster.env   $TRAF_VAR
+        if [[ -f "$TRAF_VAR/seamonster.env" ]]; then
+            echo
+            echo "Copying $TRAF_VAR/seamonster.env to $TRAF_VAR of all the nodes"
+            echo "$PDCP $ExNodeList $TRAF_VAR/seamonster.env   $TRAF_VAR "
+            $PDCP $ExNodeList $TRAF_VAR/seamonster.env   $TRAF_VAR
+        fi
 
         if [[ $sq_seamonster == 1 ]]; then 
             if [ -f $SQESPENV_FILE ]; then
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/HBaseTxClient.java b/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/HBaseTxClient.java
index 7e87546..23da11a 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/HBaseTxClient.java
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/HBaseTxClient.java
@@ -117,15 +117,14 @@
    static final Object mapLock = new Object();
 
    void setupLog4j() {
-        //System.out.println("In setupLog4J");
         System.setProperty("trafodion.logdir", System.getenv("TRAF_LOG"));
+        System.setProperty("hostName", System.getenv("HOSTNAME"));
         String confFile = System.getenv("TRAF_CONF")
             + "/log4j.dtm.config";
         PropertyConfigurator.configure(confFile);
     }
 
    public boolean init(String hBasePath, String zkServers, String zkPort) throws IOException {
-      //System.out.println("In init - hbp");
       setupLog4j();
       if (LOG.isDebugEnabled()) LOG.debug("Enter init, hBasePath:" + hBasePath);
       if (LOG.isTraceEnabled()) LOG.trace("mapTransactionStates " + mapTransactionStates + " entries " + mapTransactionStates.size());
diff --git a/core/sqf/src/tm/tmlibmsg.h b/core/sqf/src/tm/tmlibmsg.h
index 1049b7d..73a5d28 100644
--- a/core/sqf/src/tm/tmlibmsg.h
+++ b/core/sqf/src/tm/tmlibmsg.h
@@ -61,7 +61,6 @@
 #define SEABED_MAX_SETTABLE_RECVLIMIT_TM 25700
 #define SEABED_MAX_SETTABLE_SENDLIMIT_TM 25700
 
-#define MAX_FILE_NAME 64
 // MAXPROCESSNAME set at 16 for no good reason
 #define MAXPROCESSNAME 16
 // MAX_TRANS_SLOTS is the maximum number of transactions a TMLIB can have active at any time.
diff --git a/core/sqf/src/tm/tmlogging.cpp b/core/sqf/src/tm/tmlogging.cpp
index f5aab90..2d4361e 100644
--- a/core/sqf/src/tm/tmlogging.cpp
+++ b/core/sqf/src/tm/tmlogging.cpp
@@ -34,14 +34,8 @@
 
 int tm_init_logging()
 {
-	// Log4cxx logging
-        MS_Mon_Process_Info_Type  proc_info;
-        msg_mon_get_process_info_detail(NULL, &proc_info);
-        int myNid = proc_info.nid;
-        char logNameSuffix[32];
-        sprintf( logNameSuffix, "_%d.log", myNid );
-
-	CommonLogger::instance().initLog4cxx("log4cxx.trafodion.tm.config",logNameSuffix);
+    // Log4cxx logging
+    CommonLogger::instance().initLog4cxx("log4cxx.trafodion.tm.config");
     gv_log4cxx_initialized = true;
     ms_getenv_int ("TM_DUAL_LOGGING", &gv_dual_logging);
     return gv_dual_logging; 
diff --git a/core/sqf/tools/check_hbase_available/CheckHBase.java b/core/sqf/tools/check_hbase_available/CheckHBase.java
index 181bc9d..9e1ae07 100644
--- a/core/sqf/tools/check_hbase_available/CheckHBase.java
+++ b/core/sqf/tools/check_hbase_available/CheckHBase.java
@@ -37,7 +37,8 @@
 
     static void setupLog4j() {
        System.out.println("In setupLog4J");
-        String confFile = System.getenv("PWD")
+       System.setProperty("hostName", System.getenv("HOSTNAME"));
+       String confFile = System.getenv("PWD")
             + "/log4j.util.config";
         PropertyConfigurator.configure(confFile);
     }
diff --git a/core/sqf/tools/check_hbase_available/HBPerf.java b/core/sqf/tools/check_hbase_available/HBPerf.java
index 346ae82..12ab42b 100644
--- a/core/sqf/tools/check_hbase_available/HBPerf.java
+++ b/core/sqf/tools/check_hbase_available/HBPerf.java
@@ -68,9 +68,10 @@
 
     static void setupLog4j() {
        System.out.println("In setupLog4J");
-        String confFile = System.getenv("PWD")
+       System.setProperty("hostName", System.getenv("HOSTNAME"));
+       String confFile = System.getenv("PWD")
             + "/log4j.util.config";
-        PropertyConfigurator.configure(confFile);
+       PropertyConfigurator.configure(confFile);
     }
 
     // Initialize and set up tables 
diff --git a/core/sqf/tools/check_hbase_available/HBPerfWrite.java b/core/sqf/tools/check_hbase_available/HBPerfWrite.java
index 41aab71..98bde83 100644
--- a/core/sqf/tools/check_hbase_available/HBPerfWrite.java
+++ b/core/sqf/tools/check_hbase_available/HBPerfWrite.java
@@ -67,7 +67,8 @@
 
 
     static void setupLog4j() {
-       System.out.println("In setupLog4J");
+        System.out.println("In setupLog4J");
+        System.setProperty("hostName", System.getenv("HOSTNAME"));      
         String confFile = System.getenv("PWD")
             + "/log4j.util.config";
         PropertyConfigurator.configure(confFile);
diff --git a/core/sqf/tools/check_hbase_available/HBPerf_agg_count.java b/core/sqf/tools/check_hbase_available/HBPerf_agg_count.java
index 1a71bb7..35e1144 100644
--- a/core/sqf/tools/check_hbase_available/HBPerf_agg_count.java
+++ b/core/sqf/tools/check_hbase_available/HBPerf_agg_count.java
@@ -39,7 +39,8 @@
 public class HBPerf_agg_count{
 
     static void setupLog4j() {
-       System.out.println("In setupLog4J");
+        System.out.println("In setupLog4J");
+        System.setProperty("hostName", System.getenv("HOSTNAME"));
         String confFile = System.getenv("PWD")
             + "/log4j.util.config";
         PropertyConfigurator.configure(confFile);
diff --git a/core/sqf/tools/check_hbase_available/HBPerf_counter.java b/core/sqf/tools/check_hbase_available/HBPerf_counter.java
index 0e6c535..2e01367 100644
--- a/core/sqf/tools/check_hbase_available/HBPerf_counter.java
+++ b/core/sqf/tools/check_hbase_available/HBPerf_counter.java
@@ -42,7 +42,8 @@
 public class HBPerf_counter{
 
     static void setupLog4j() {
-       System.out.println("In setupLog4J");
+        System.out.println("In setupLog4J");
+        System.setProperty("hostName", System.getenv("HOSTNAME"));  
         String confFile = System.getenv("PWD")
             + "/log4j.util.config";
         PropertyConfigurator.configure(confFile);
diff --git a/core/sqf/tools/check_hbase_available/HBTransPerf.java b/core/sqf/tools/check_hbase_available/HBTransPerf.java
index 1f123ac..e368ed0 100755
--- a/core/sqf/tools/check_hbase_available/HBTransPerf.java
+++ b/core/sqf/tools/check_hbase_available/HBTransPerf.java
@@ -74,7 +74,8 @@
     private static TransactionManager transactionManager;
 
     static void setupLog4j() {
-       System.out.println("In setupLog4J");
+        System.out.println("In setupLog4J");
+        System.setProperty("hostName", System.getenv("HOSTNAME"));
         String confFile = System.getenv("PWD")
             + "/log4j.util.config";
         PropertyConfigurator.configure(confFile);
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index e66074a..113abc4 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -1476,6 +1476,7 @@
 7003 42000 99999 BEGINNER MAJOR DBADMIN A plan using cluster sampling could not be produced for this query.
 7004 ZZZZZ 99999 BEGINNER MAJOR DBADMIN A parallel extract plan could not be produced. Possible causes include an incompatible Control Query Shape (CQS) specification, use of rowset expressions, or use of SQL features that cannot be parallelized such as [FIRST/LAST N], table-valued functions, stream access to tables, and embedded updates or deletes.
 7005 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Use of selection predicates in parallel extract consumer queries is not allowed.
+7008 ZZZZZ 99999 BEGINNER MINOR DBADMIN IUD not supported with hbase replication enabled table $0~TableName when HBASE_READ_REPLICA is enabled. 
 7350 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Incompatible consistency level of $0~Int0 for Halloween protection
 7351 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Incompatible lock size of $0~Int0 for Halloween protection.
 7352 ZZZZZ 99999 BEGINNER MAJOR DBADMIN A Hash-Join that may overflow its memory to disk can not accept input rows longer than $0~Int0 bytes.
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/executor/ex_transaction.cpp b/core/sql/executor/ex_transaction.cpp
index fcb5141..e843524 100644
--- a/core/sql/executor/ex_transaction.cpp
+++ b/core/sql/executor/ex_transaction.cpp
@@ -1,4 +1,4 @@
-/**********************************************************************
+/*********************************************************************
 // @@@ START COPYRIGHT @@@
 //
 // Licensed to the Apache Software Foundation (ASF) under one
@@ -642,7 +642,7 @@
 
       if (rc == FEHASCONFLICT)
         createDiagsArea (EXE_COMMIT_CONFLICT_FROM_TRANS_SUBSYS, rc,
-                         (errStr && errlen)? errStr: "DTM");
+                         (errStr && errlen)? "CONFLICT ERROR" : "DTM");
       else
         createDiagsArea (EXE_COMMIT_ERROR_FROM_TRANS_SUBSYS, rc,
                           (errStr && errlen)? errStr: "DTM");
diff --git a/core/sql/qmscommon/QRLogger.cpp b/core/sql/qmscommon/QRLogger.cpp
index 3d20222..f71a607 100644
--- a/core/sql/qmscommon/QRLogger.cpp
+++ b/core/sql/qmscommon/QRLogger.cpp
@@ -177,37 +177,7 @@
   if (gv_QRLoggerInitialized_)
      return TRUE;
  
-  // get the log directory
-  logFileName = "";
-
-  // gets the top ancestor process name that will be used to name the file appender log
-  char logFileSuffix [100]="";
-  static bool singleSqlLogFile = (getenv("TRAF_MULTIPLE_SQL_LOG_FILE") == NULL);
-  switch (module_)
-  {
-    case QRL_NONE:
-    case QRL_MXCMP:
-    case QRL_ESP:
-    case QRL_MXEXE:
-    case QRL_UDR:
-      if (singleSqlLogFile) 
-         getMyNidSuffix(logFileSuffix);
-      else 
-         getMyTopAncestor(logFileSuffix);
-      break;
-    case QRL_LOB:
-      getMyNidSuffix(logFileSuffix);
-      break; 
-    case QRL_SSMP:
-    case QRL_SSCP:
-      getMyNidSuffix(logFileSuffix);
-      break;
-    default:
-      break;
-  }
-
-  
-  if (CommonLogger::initLog4cxx(configFileName, logFileSuffix))
+  if (CommonLogger::initLog4cxx(configFileName))
   {
     introduceSelf();
     gv_QRLoggerInitialized_ = TRUE;
diff --git a/core/sql/runtimestats/ssmpipc.cpp b/core/sql/runtimestats/ssmpipc.cpp
index 64b23dd..6cfa784 100755
--- a/core/sql/runtimestats/ssmpipc.cpp
+++ b/core/sql/runtimestats/ssmpipc.cpp
@@ -782,45 +782,78 @@
   int error;
   char tempQid[ComSqlId::MAX_QUERY_ID_LEN+1];
 
-
+  static int stopProcessAfterInSecs = 
+             (getenv("MIN_QUERY_ACTIVE_TIME_IN_SECS_BEFORE_CANCEL") != NULL ? atoi(getenv("MIN_QUERY_ACTIVE_TIME_IN_SECS_BEFORE_CANCEL")) : -1);
   ActiveQueryEntry * aq = (queryId ? getActiveQueryMgr().getActiveQuery(
                        queryId, queryIdLen) : NULL);
+  ExMasterStats * cMasterStats = NULL;
+  StmtStats *cqStmtStats = NULL;
 
   if (aq == NULL)
   {
      error = statsGlobals->getStatsSemaphore(getSemId(), myPin());
-     StmtStats *cqStmtStats = statsGlobals->getMasterStmtStats(
+     cqStmtStats = statsGlobals->getMasterStmtStats(
                 queryId, queryIdLen,
                 RtsQueryId::ANY_QUERY_);
-     if (cqStmtStats == NULL)
+     if (cqStmtStats == NULL) {
         sqlErrorCode = -EXE_CANCEL_QID_NOT_FOUND;
-     else
-     {
-        ExMasterStats * cMasterStats = cqStmtStats->getMasterStats();
-        if (cMasterStats)
-        {
+        statsGlobals->releaseStatsSemaphore(getSemId(), myPin());
+     } else {
+        cMasterStats = cqStmtStats->getMasterStats();
+        if (cMasterStats == NULL) {
+            sqlErrorCode = -EXE_CANCEL_NOT_POSSIBLE;
+            sqlErrorDesc = "The query is not registered with cancel broker";
+            statsGlobals->releaseStatsSemaphore(getSemId(), myPin());
+        } else {
            Statement::State stmtState = (Statement::State)cMasterStats->getState();
            if (stmtState != Statement::OPEN_ &&
                    stmtState  != Statement::FETCH_ &&
-                   stmtState != Statement::STMT_EXECUTE_)
-           {
+                   stmtState != Statement::STMT_EXECUTE_) {
               sqlErrorCode = -EXE_CANCEL_NOT_POSSIBLE;
               sqlErrorDesc = "The query is not in OPEN or FETCH or EXECUTE state";
-           }
-           else
-           {
-              sqlErrorCode = -EXE_CANCEL_NOT_POSSIBLE;
-              sqlErrorDesc = "The query is not registered with the cancel broker";
-           }
-        }
-        else
-        {
-           sqlErrorCode = -EXE_CANCEL_NOT_POSSIBLE;
-           sqlErrorDesc = "The query state is not known";
-        }
-     }
-     statsGlobals->releaseStatsSemaphore(getSemId(), myPin());
-  }
+              statsGlobals->releaseStatsSemaphore(getSemId(), myPin());
+           } else {
+              if ((stopProcessAfterInSecs <= 0) || (cMasterStats->getExeEndTime() != -1)) {
+                 sqlErrorCode = -EXE_CANCEL_NOT_POSSIBLE;
+                 sqlErrorDesc = "The query can't be canceled because it finished processing";
+                 statsGlobals->releaseStatsSemaphore(getSemId(), myPin());
+              } else {
+                 Int64 exeStartTime = cMasterStats->getExeStartTime();
+                 int exeElapsedTimeInSecs = 0;
+                 if (exeStartTime != -1) {
+                    Int64 exeElapsedTime = NA_JulianTimestamp() - cMasterStats->getExeStartTime();
+                    exeElapsedTimeInSecs = exeElapsedTime / 1000000;
+                 }
+                 statsGlobals->releaseStatsSemaphore(getSemId(), myPin());
+                 if (exeElapsedTimeInSecs > 0 && exeElapsedTimeInSecs > (stopProcessAfterInSecs)) {
+                    sqlErrorCode = stopMasterProcess(queryId, queryIdLen); 
+                    if (sqlErrorCode != 0) {
+                       switch (sqlErrorCode) {
+                          case -1:
+                             sqlErrorDesc = "Unable to get node number";
+                             break;
+                          case -2:
+                             sqlErrorDesc = "Unable to get pid";
+                             break;
+                          case -3:
+                             sqlErrorDesc = "Unable to get process name";
+                             break;
+                          default:
+                             sqlErrorDesc = "Unable to stop the process";
+                             break; 
+                       } // switch
+                       sqlErrorCode = -EXE_CANCEL_NOT_POSSIBLE;
+                    } else 
+                      didAttemptCancel = true;
+                 } else {
+                     sqlErrorDesc = "The query can't be canceled because cancel was requested earlier than required minimum query active time";
+                     sqlErrorCode = -EXE_CANCEL_NOT_POSSIBLE;
+                 } // stopAfterNSecs
+              } // ExeEndTime
+          } //StmtState
+       } // cMasterStats 
+    } // cqStmtStats
+  } // aq
   else
   if (aq && (aq->getQueryStartTime() <= cancelStartTime))
   {
@@ -1009,6 +1042,23 @@
   return doAttemptActivate;
 }
 
+Lng32 SsmpGlobals::stopMasterProcess(char *queryId, Lng32 queryIdLen)
+{
+   Lng32 retcode;
+   Int64 node;
+   Int64 pin;
+   char processName[MS_MON_MAX_PROCESS_NAME+1];
+
+   if ((retcode = ComSqlId::getSqlSessionIdAttr(ComSqlId::SQLQUERYID_CPUNUM, queryId, queryIdLen, node, NULL)) != 0)
+      return -1;
+   if ((retcode = ComSqlId::getSqlSessionIdAttr(ComSqlId::SQLQUERYID_PIN, queryId, queryIdLen, pin, NULL)) != 0)
+      return -2;
+   if ((retcode = msg_mon_get_process_name((int)node, (int)pin, processName)) != XZFIL_ERR_OK)
+      return -3; 
+   if ((retcode = msg_mon_stop_process_name(processName)) != XZFIL_ERR_OK)
+      return retcode;   
+   return 0;    
+}
 
 void SsmpGuaReceiveControlConnection::actOnSystemMessage(
        short                  messageNum,
diff --git a/core/sql/runtimestats/ssmpipc.h b/core/sql/runtimestats/ssmpipc.h
index 7171e9b..3a9c0bd 100644
--- a/core/sql/runtimestats/ssmpipc.h
+++ b/core/sql/runtimestats/ssmpipc.h
@@ -140,6 +140,7 @@
                        bool suspendLogging);
   void suspendOrActivate(char *queryId, Lng32 qidLen, 
                          SuspendOrActivate sOrA, bool suspendLogging);
+  Lng32 stopMasterProcess(char *queryId, Lng32 queryIdLen);
 
 private:
 
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
diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
index ddd7a7b..1a5bc57 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
@@ -173,6 +173,11 @@
     }
 
     static {
+        System.setProperty("hostName", System.getenv("HOSTNAME"));
+        String trafLog = System.getProperty("TRAF_LOG"); 
+        if (trafLog == null) {  
+            System.setProperty("TRAF_LOG", System.getenv("TRAF_LOG"));  
+        } 
     	String confFile = System.getProperty("trafodion.log4j.configFile");
         System.setProperty("trafodion.root", System.getenv("TRAF_HOME"));
     	if (confFile == null) {
diff --git a/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java b/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java
index 28d9187..d39380a 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java
@@ -127,6 +127,7 @@
    private SequenceFile.CompressionType seqCompressionType_;
 
    static {
+      System.setProperty("hostName", System.getenv("HOSTNAME"));
       String confFile = System.getProperty("trafodion.log4j.configFile");
       System.setProperty("trafodion.root", System.getenv("TRAF_HOME"));
       if (confFile == null) {
diff --git a/core/sql/src/main/java/org/trafodion/sql/HTableClient.java b/core/sql/src/main/java/org/trafodion/sql/HTableClient.java
index c228c36..f363b3c 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HTableClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HTableClient.java
@@ -136,6 +136,7 @@
 	int fetchType = 0;
 	long jniObject = 0;
 	SnapshotScanHelper snapHelper = null;
+        static boolean enableHbaseScanForSkipReadConflict;
 
 	 class SnapshotScanHelper
 	 {
@@ -1152,7 +1153,7 @@
 			numColsInScan = 0;
 		if (useTRex && (transID != 0)) {
 			getResultSet = batchGet(transID, listOfGets);
-                        fetchType = GET_ROW; 
+     			fetchType = GET_ROW; 
 		} else {
 			getResultSet = table.get(listOfGets);
 			fetchType = BATCH_GET;
diff --git a/core/sql/src/main/java/org/trafodion/sql/HiveClient.java b/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
index 9e97806..a274b88 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
@@ -100,10 +100,11 @@
     private static Statement stmt = null;
 
     static {
+         System.setProperty("hostName", System.getenv("HOSTNAME"));
          String confFile = System.getProperty("trafodion.log4j.configFile");
          System.setProperty("trafodion.root", System.getenv("TRAF_HOME"));
          if (confFile == null) 
-         confFile = System.getenv("TRAF_CONF") + "/log4j.sql.config";
+            confFile = System.getenv("TRAF_CONF") + "/log4j.sql.config";
          PropertyConfigurator.configure(confFile);
          hiveConf = new HiveConf();
          hiveMetaClient = new ThreadLocal<HiveMetaStoreClient>();
diff --git a/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java b/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java
index b3913de..b255c66 100644
--- a/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java
+++ b/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java
@@ -50,6 +50,7 @@
 	   (in case of an ESP, e.g.) when the class:org.trafodion.sql.HBaseClient (which initializes log4j 
            for the org.trafodion.sql package) hasn't been loaded.
 	*/
+        System.setProperty("hostName", System.getenv("HOSTNAME"));
     	String confFile = System.getProperty("trafodion.log4j.configFile");
     	if (confFile == null) {
     		System.setProperty("trafodion.sql.log", System.getenv("TRAF_LOG") + "/trafodion.sql.java.log");
diff --git a/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java b/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java
index 88995cc..cbe26fc 100644
--- a/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java
+++ b/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java
@@ -55,9 +55,10 @@
   boolean isEOF = false;
   String lastError = null;  
   static { 
+    System.setProperty("hostName", System.getenv("HOSTNAME"));
     String confFile = System.getProperty("trafodion.log4j.configFile");
     if (confFile == null) {
-   	System.setProperty("trafodion.sql.log", System.getenv("TRAF_LOG") + "/trafodion.sql.java.log");
+        System.setProperty("trafodion.sql.log", System.getenv("TRAF_LOG") + "/trafodion.sql.java.${hostName}.log");
     	confFile = System.getenv("TRAF_CONF") + "/log4j.sql.config";
     }
     PropertyConfigurator.configure(confFile);
diff --git a/core/sql/src/main/java/org/trafodion/sql/SequenceFileWriter.java b/core/sql/src/main/java/org/trafodion/sql/SequenceFileWriter.java
index ff88dd7..5a493d1 100644
--- a/core/sql/src/main/java/org/trafodion/sql/SequenceFileWriter.java
+++ b/core/sql/src/main/java/org/trafodion/sql/SequenceFileWriter.java
@@ -85,6 +85,7 @@
      */
     static {
        conf = TrafConfiguration.create(TrafConfiguration.HDFS_CONF);
+       System.setProperty("hostName", System.getenv("HOSTNAME"));
     }
     SequenceFileWriter() throws IOException
     {
diff --git a/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java b/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java
index db64663..dbcbe9a 100644
--- a/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java
+++ b/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java
@@ -82,6 +82,7 @@
     private SizeInfo currRegionSizeInfo = null;
 
     static {
+        System.setProperty("hostName", System.getenv("HOSTNAME"));
     	String confFile = System.getProperty("trafodion.log4j.configFile");
         System.setProperty("trafodion.root", System.getenv("TRAF_HOME"));
     	if (confFile == null)