This is an automated email from the ASF dual-hosted git repository.

selva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafodion.git


The following commit(s) were added to refs/heads/master by this push:
     new 99cb1cd  [TRAFODION-3331] JDBC T4 driver to support login timeout and 
query timeout
     new 7ac4915  Merge pull request #1861 from selvaganesang/t4_query_timeout
99cb1cd is described below

commit 99cb1cd29602983d1040c0df6f452fde5486216b
Author: selvaganesang <se...@apache.org>
AuthorDate: Fri Oct 4 03:53:11 2019 +0000

    [TRAFODION-3331] JDBC T4 driver to support login timeout and query timeout
    
    1. Support to cancel the query when cqd CANCEL_QUERY_ALLOWED is set to OFF.
    
    When this CQD is set to OFF, the query can't be canceled gracefully
    because the query is not registered with cancel broker.
    This change allows the master process to be stopped and abort the query
    abruptly when the query is active for longer than the minimum required
    time. To activate this feature.
    a) A variable MIN_QUERY_ACTIVE_TIME_IN_SECS_BEFORE_CANCEL=n need to be set
       where 'n' is duration in secs
    b) control query cancel qid <qid> needs to issued after 'n' seconds.
    2. Streamlined the query timeout concept in JDBC driver and Sync up JDBC 
driver with this concept in the server side.
    a) The 2 properties ignoreCancel and activeTimeBeforeCancelInSecs can be 
used to enable query timeout
       and cancel from JDBC driver. By default ignoreCancel is set to true, 
activeTimeBeforeCancelInSecs is set to -1.
    b) During socket read, timeout is set based on type of request.
       If it is connection related, timeout is login timeout and it will be 
query timeout otherwise.
    c) By default network timeout is set to 1 secs. socket read times out every 
1 sec and check if the timeout has elapsed.
    d) If the timeout pertains to the login timeout, an error is returned.
    e) If the timeout pertains to the query timeout, if ignoreCancel is false, 
control query cancel qid is sent.
       If ignoreCancel is true, it is checked if the query has been active 
longer than activeTimeBeforeCancel. Then cancel is sent to server.
    f) If Statement.cancel is issued by the application, then it is checked if 
the connection is waiting in socket read.
       If so, the above timeout mechanism can kick in to send cancel to the 
server.
       If not, an internal close is issued to the server to free up system 
resources associated with the statement.
---
 .../java/org/trafodion/jdbc/t4/InputOutput.java    | 246 ++++++++++---------
 .../org/trafodion/jdbc/t4/InterfaceConnection.java |  79 +++---
 .../org/trafodion/jdbc/t4/InterfaceStatement.java  |  28 ++-
 .../java/org/trafodion/jdbc/t4/T4Connection.java   |   7 +-
 .../java/org/trafodion/jdbc/t4/T4DSProperties.java |  93 -------
 .../main/java/org/trafodion/jdbc/t4/T4Driver.java  |   3 +-
 .../java/org/trafodion/jdbc/t4/T4Properties.java   | 268 ++++++---------------
 .../java/org/trafodion/jdbc/t4/T4Statement.java    |   6 +
 .../java/org/trafodion/jdbc/t4/T4_Dcs_Cancel.java  |   5 +-
 .../java/org/trafodion/jdbc/t4/T4_Dcs_Connect.java |  13 +-
 .../org/trafodion/jdbc/t4/TrafT4Connection.java    |  37 +--
 .../trafodion/jdbc/t4/TrafT4PreparedStatement.java |   4 -
 .../org/trafodion/jdbc/t4/TrafT4Statement.java     |  26 +-
 .../org_apache_trafodion_jdbc_t2_SQLMXClobReader.h |  23 --
 .../org_apache_trafodion_jdbc_t2_SQLMXClobWriter.h |  21 --
 ..._apache_trafodion_jdbc_t2_SQLMXLobInputStream.h |  23 --
 ...apache_trafodion_jdbc_t2_SQLMXLobOutputStream.h |  21 --
 core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp    |   4 +
 core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h   |  10 +-
 core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp |   4 +
 core/sqf/conf/log4cxx.trafodion.sql.config         |   2 +-
 core/sql/bin/SqlciErrors.txt                       |   1 +
 core/sql/runtimestats/ssmpipc.cpp                  | 100 ++++++--
 core/sql/runtimestats/ssmpipc.h                    |   1 +
 .../main/java/org/trafodion/sql/HTableClient.java  |   3 +-
 25 files changed, 381 insertions(+), 647 deletions(-)

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 @@ package org.trafodion.jdbc.t4;
 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 @@ class InputOutput {
        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 @@ class InputOutput {
 
         // 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 @@ class InputOutput {
                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 @@ class InputOutput {
 
        } // 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 @@ class InputOutput {
                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 @@ class InputOutput {
        // ----------------------------------------------------------
        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 @@ class InputOutput {
                                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 @@ class InputOutput {
                                                // 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 @@ class InputOutput {
                        } // 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 @@ class InputOutput {
                }
                
                // 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 @@ class InputOutput {
                        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 @@ class InputOutput {
        } // 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 @@ class InputOutput {
                } finally {
                        closeTimers();
                }
-       } // end CloseIO
+       } // end closeIO
 
        void TCPIPWriteByteBuffer(ByteBuffer buffer) throws SQLException {
 
@@ -545,7 +522,7 @@ class InputOutput {
                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 @@ class InputOutput {
        } // 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;
+                       boolean innerRetry = true;
+                       int innerRetryCnt = 0;
+                       int pendingTimeout = m_timeout * 1000;
+                       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;
+                                       outerRetry = false;
+                               }
+                               catch (SocketTimeoutException ste) {
+                                       pendingTimeout -= 
m_networkTimeoutInMillis;
+                                       if (pendingTimeout <= 0) {
                                                innerRetry = false;
-                                               retry = false;
-                                       }
-                                       catch (SocketTimeoutException ste) {
-                                               pendingTimeout -= 
m_networkTimeout;
-                                               if (pendingTimeout < 0) {
-                                                       innerRetry = false;
-                                                       throw ste;
+                                               break;
+                                       }
+                               }
+                               catch (IOException ioe) {
+                                       if (innerRetryCnt <= 3) {
+                                               try {
+                                                       innerRetryCnt++;
+                                                       Thread.sleep(10);
+                                               } catch(InterruptedException 
ie) {
                                                }
-                                       }
-                               } 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
-                               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;
+                                       } 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);
                                }
-                       } catch (Exception e) {
-                               SQLException se = 
TrafT4Messages.createSQLException(null, m_locale, "socket_read_error", 
e.getMessage());
-                               se.initCause(e);
                                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 @@ class InterfaceConnection {
        
        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 @@ class InterfaceConnection {
        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 @@ class InterfaceConnection {
                // 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 @@ class InterfaceConnection {
                return this._roleName;
        }
 
+       boolean getIgnoreCancel() {
+               return this._ignoreCancel;
+       }
+
        CONNECTION_CONTEXT_def getInContext() {
                return inContext;
        }
@@ -477,56 +483,44 @@ class InterfaceConnection {
                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;
-       
-                       if (inContext.loginTimeoutSec > 0) {
-                               endTime = currentTime + 
inContext.loginTimeoutSec * 1000;
-                       } else {
+               }
        
-                               // less than or equal to 0 implies infinit time 
out
-                               endTime = Long.MAX_VALUE;
+               cr_ = T4_Dcs_Cancel.cancel(t4props_, this, dialogueId_, 
srvrType, srvrObjRef, 0);
        
-                               //
-                               // 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 @@ class InterfaceConnection {
                                        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 @@ class InterfaceConnection {
                                        }
 
                                        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 @@ class InterfaceStatement {
        } // 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 @@ class InterfaceStatement {
            }
        }
 
-    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 @@ class T4Connection {
                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 @@ class T4Connection {
                        // 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 @@ public class T4DSProperties extends T4Properties {
        }
 
        /**
-        * 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 @@ public class T4Driver extends T4Properties implements 
java.sql.Driver {
                                        }
                                }
                                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 @@ import javax.naming.StringRefAddr;
  * </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 @@ public class T4Properties {
        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 @@ public class T4Properties {
        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 @@ public class T4Properties {
        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 @@ public class T4Properties {
 
        // 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 @@ public class T4Properties {
                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 @@ public class T4Properties {
                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 @@ public class T4Properties {
                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 @@ public class T4Properties {
         * @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 @@ public class T4Properties {
         *            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 @@ public class T4Properties {
                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 @@ public class T4Properties {
         */
 
        /**
-        * 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 @@ public class T4Properties {
                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 @@ public class T4Properties {
                 * 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 @@ public class T4Properties {
                                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 @@ final class T4Statement {
                }
                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 @@ class T4_Dcs_Cancel {
                        // 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 @@ class T4_Dcs_Cancel {
                        //
                        // 
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 @@ class T4_Dcs_Connect {
                        se.setNextException(se2);
                        throw se;
                }
+               InputOutput io1 = null;
                try {
                        LogicalByteArray rbuffer;
                        LogicalByteArray wbuffer;
@@ -72,10 +73,10 @@ class T4_Dcs_Connect {
                        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 @@ class T4_Dcs_Connect {
 
                        // 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 @@ class T4_Dcs_Connect {
 
                        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 @@ public class TrafT4Connection extends 
PreparedStatementManager implements java.s
 
        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 class TrafT4Connection extends 
PreparedStatementManager implements java.s
 
        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 @@ public class TrafT4PreparedStatement extends 
TrafT4Statement implements java.sql
                        connection_.props_.getLogWriter().println(temp);
                }
                int dataType;
-               long dataLocator;
 
                validateSetInvocation(parameterIndex);
 
@@ -591,7 +590,6 @@ public class TrafT4PreparedStatement extends 
TrafT4Statement implements java.sql
                        connection_.props_.getLogWriter().println(temp);
                }
                int dataType;
-               long dataLocator;
 
                validateSetInvocation(parameterIndex);
 
@@ -675,7 +673,6 @@ public class TrafT4PreparedStatement extends 
TrafT4Statement implements java.sql
                        connection_.props_.getLogWriter().println(temp);
                }
                int dataType;
-               long dataLocator;
 
                validateSetInvocation(parameterIndex);
                dataType = inputDesc_[parameterIndex - 1].dataType_;
@@ -809,7 +806,6 @@ public class TrafT4PreparedStatement extends 
TrafT4Statement implements java.sql
                }
                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 @@ public class TrafT4Statement extends TrafT4Handle implements 
java.sql.Statement
                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 @@ public class TrafT4Statement extends TrafT4Handle 
implements java.sql.Statement
                        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/native/org_apache_trafodion_jdbc_t2_SQLMXClobReader.h 
b/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXClobReader.h
deleted file mode 100644
index 9afe0e8..0000000
--- a/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXClobReader.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_apache_trafodion_jdbc_t2_SQLMXClobReader */
-
-#ifndef _Included_org_apache_trafodion_jdbc_t2_SQLMXClobReader
-#define _Included_org_apache_trafodion_jdbc_t2_SQLMXClobReader
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef org_apache_trafodion_jdbc_t2_SQLMXClobReader_maxSkipBufferSize
-#define org_apache_trafodion_jdbc_t2_SQLMXClobReader_maxSkipBufferSize 8192L
-/*
- * Class:     org_apache_trafodion_jdbc_t2_SQLMXClobReader
- * Method:    readChunk
- * Signature: (Ljava/lang/String;JJILjava/lang/String;Ljava/nio/CharBuffer;)I
- */
-JNIEXPORT jint JNICALL 
Java_org_apache_trafodion_jdbc_t2_SQLMXClobReader_readChunk
-  (JNIEnv *, jobject, jstring, jlong, jlong, jint, jstring, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git 
a/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXClobWriter.h 
b/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXClobWriter.h
deleted file mode 100644
index 9cdc0f6..0000000
--- a/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXClobWriter.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_apache_trafodion_jdbc_t2_SQLMXClobWriter */
-
-#ifndef _Included_org_apache_trafodion_jdbc_t2_SQLMXClobWriter
-#define _Included_org_apache_trafodion_jdbc_t2_SQLMXClobWriter
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class:     org_apache_trafodion_jdbc_t2_SQLMXClobWriter
- * Method:    writeChunk
- * Signature: (Ljava/lang/String;JJLjava/lang/String;Ljava/lang/String;J)V
- */
-JNIEXPORT void JNICALL 
Java_org_apache_trafodion_jdbc_t2_SQLMXClobWriter_writeChunk
-  (JNIEnv *, jobject, jstring, jlong, jlong, jstring, jstring, jlong);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git 
a/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXLobInputStream.h
 
b/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXLobInputStream.h
deleted file mode 100644
index 2f113cf..0000000
--- 
a/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXLobInputStream.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_apache_trafodion_jdbc_t2_SQLMXLobInputStream */
-
-#ifndef _Included_org_apache_trafodion_jdbc_t2_SQLMXLobInputStream
-#define _Included_org_apache_trafodion_jdbc_t2_SQLMXLobInputStream
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef org_apache_trafodion_jdbc_t2_SQLMXLobInputStream_MAX_SKIP_BUFFER_SIZE
-#define org_apache_trafodion_jdbc_t2_SQLMXLobInputStream_MAX_SKIP_BUFFER_SIZE 
2048L
-/*
- * Class:     org_apache_trafodion_jdbc_t2_SQLMXLobInputStream
- * Method:    readChunk
- * Signature: (Ljava/lang/String;JJILjava/lang/String;Ljava/nio/ByteBuffer;)I
- */
-JNIEXPORT jint JNICALL 
Java_org_apache_trafodion_jdbc_t2_SQLMXLobInputStream_readChunk
-  (JNIEnv *, jobject, jstring, jlong, jlong, jint, jstring, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git 
a/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream.h
 
b/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream.h
deleted file mode 100644
index 9de819e..0000000
--- 
a/core/conn/jdbc_type2/native/org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream */
-
-#ifndef _Included_org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream
-#define _Included_org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class:     org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream
- * Method:    writeChunk
- * Signature: (Ljava/lang/String;JJLjava/lang/String;[BIIJ)V
- */
-JNIEXPORT void JNICALL 
Java_org_apache_trafodion_jdbc_t2_SQLMXLobOutputStream_writeChunk
-  (JNIEnv *, jobject, jstring, jlong, jlong, jstring, jbyteArray, jint, jint, 
jlong);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
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 @@ odbc_SQLSrvr_Prepare_ame_(
                                                                        
stmtLabel,
                                                                        
sqlString,
                                                                        
holdableCursor,
+                                                                       
queryTimeout,                   
                                                                        
&returnCode,
                                                                        
&sqlWarningOrErrorLength,
                                                                        
sqlWarningOrError,
@@ -6350,6 +6351,7 @@ odbc_SQLSrvr_Prepare_ame_(
                                                                        
stmtLabel,
                                                                        
sqlString,
                                                                        
holdableCursor,
+                                                                       
queryTimeout,
                                                                        
&returnCode,
                                                                        
&sqlWarningOrErrorLength,
                                                                        
sqlWarningOrError,
@@ -6897,6 +6899,7 @@ odbc_SQLSrvr_ExecDirect_ame_(
                                                                                
        stmtLabel,
                                                                                
        sqlString,
                                                                                
        holdableCursor,
+                                                                               
        queryTimeout,
                                                                                
        &returnCode,
                                                                                
        &sqlWarningOrErrorLength,
                                                                                
        sqlWarningOrError,
@@ -6981,6 +6984,7 @@ odbc_SQLSrvr_ExecDirect_ame_(
                                        stmtLabel,
                                        sqlString,
                                        holdableCursor,
+                                       queryTimeout,
                                        &returnCode,
                                        &sqlWarningOrErrorLength,
                                        sqlWarningOrError,
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 @@ odbc_SQLSvc_Prepare2_sme_(
   , /* 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 void translateToUTF8(Int32 inCharset, char* inStr, 
Int32 inStrLen, char*
 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 @@ odbc_SQLSvc_Prepare2_sme_(
   , /* 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 @@ odbc_SQLSvc_Execute2_sme_(
                                  , sqlStmtType
                                  , inputRowCnt
                                  , holdableCursor
+                                  , queryTimeout
                                  , &rc
                                  , returnCode
                                  , sqlWarningOrErrorLength
@@ -1746,6 +1748,7 @@ odbc_SQLSvc_Execute2withRowsets_sme_(
                                  , sqlStmtType
                                  , inputRowCnt
                                  , holdableCursor
+                                 , queryTimeout
                                  ,&rc
                                  , returnCode
                                  , sqlWarningOrErrorLength
@@ -2075,6 +2078,7 @@ rePrepare2( SRVR_STMT_HDL *pSrvrStmt
                        , Int32                 sqlStmtType
                        , Int32                 inputRowCnt
                        , Int32         holdableCursor
+                       , Int32 queryTimeout
                        , SQLRETURN     *rc
                        , Int32          *returnCode
                        , Int32      *sqlWarningOrErrorLength
diff --git a/core/sqf/conf/log4cxx.trafodion.sql.config 
b/core/sqf/conf/log4cxx.trafodion.sql.config
index a6f9e11..b8079b4 100644
--- a/core/sqf/conf/log4cxx.trafodion.sql.config
+++ b/core/sqf/conf/log4cxx.trafodion.sql.config
@@ -40,7 +40,7 @@ log4j.appender.sqlAppender.layout.ConversionPattern=%d, %p, 
%c, %m%n
 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/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 @@ $1~String1 --------------------------------
 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/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 @@ bool SsmpGlobals::cancelQuery(char *queryId, Lng32 
queryIdLen,
   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 @@ bool SsmpGlobals::activateFromQid(
   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 @@ public:
                        bool suspendLogging);
   void suspendOrActivate(char *queryId, Lng32 qidLen, 
                          SuspendOrActivate sOrA, bool suspendLogging);
+  Lng32 stopMasterProcess(char *queryId, Lng32 queryIdLen);
 
 private:
 
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 @@ public class HTableClient {
        int fetchType = 0;
        long jniObject = 0;
        SnapshotScanHelper snapHelper = null;
+        static boolean enableHbaseScanForSkipReadConflict;
 
         class SnapshotScanHelper
         {
@@ -1152,7 +1153,7 @@ public class HTableClient {
                        numColsInScan = 0;
                if (useTRex && (transID != 0)) {
                        getResultSet = batchGet(transID, listOfGets);
-                        fetchType = GET_ROW; 
+                       fetchType = GET_ROW; 
                } else {
                        getResultSet = table.get(listOfGets);
                        fetchType = BATCH_GET;

Reply via email to