You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/05/02 18:11:52 UTC

[13/60] incubator-trafodion git commit: TRAFODION-1933 JDBC TYpe4 driver build scripts migrated to use maven instead of ant

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceStatement.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceStatement.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceStatement.java
deleted file mode 100644
index e6c7af8..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceStatement.java
+++ /dev/null
@@ -1,1392 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.math.BigDecimal;
-import java.sql.DataTruncation;
-import java.sql.Date;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Locale;
-import java.util.logging.Level;
-
-class InterfaceStatement {
-	InterfaceConnection ic_;
-	private long rowCount_;
-	static final short SQL_DROP = 1;
-	static short EXTERNAL_STMT = 0;
-	int sqlStmtType_ = TRANSPORT.TYPE_UNKNOWN;
-	int stmtType_ = 0;
-	T4Statement t4statement_;
-	int queryTimeout_;
-	String stmtLabel_;
-	String cursorName_;
-	TrafT4Statement stmt_;
-
-	int sqlQueryType_;
-	int stmtHandle_;
-	int estimatedCost_;
-	boolean prepare2 = false;
-	boolean stmtIsLock = false; 
-
-	// used for SPJ transaction
-	static Class LmUtility_class_ = null;
-	static java.lang.reflect.Method LmUtility_getTransactionId_ = null;
-
-	PrepareReply pr_;
-
-	// ----------------------------------------------------------------------
-	InterfaceStatement(TrafT4Statement stmt) throws SQLException {
-		this.ic_ = ((TrafT4Connection) stmt.getConnection()).getServerHandle();
-		queryTimeout_ = stmt.queryTimeout_;
-		stmtLabel_ = stmt.stmtLabel_;
-		cursorName_ = stmt.cursorName_;
-		t4statement_ = new T4Statement(this);
-		stmt_ = stmt;
-	};
-
-	public int getSqlQueryType() {
-		return sqlQueryType_;
-	}
-
-	private String convertDateFormat(String dt) {
-		String tokens[] = dt.split("[/]", 3);
-
-		if (tokens.length != 3) {
-			return dt;
-		}
-		StringBuffer sb = new StringBuffer();
-		sb.append(tokens[0]).append("-").append(tokens[1]).append("-").append(tokens[2]);
-		return sb.toString();
-	}
-
-	// ----------------------------------------------------------------------
-	/**
-	 * This method will take an object and convert it to the approperite format
-	 * for sending to TrafT4.
-	 * 
-	 * @param locale
-	 *            The locale for this operation
-	 * @param pstmt
-	 *            The prepared statement associated with the object
-	 * @param paramValue
-	 *            The object to convert
-	 * @param paramNumber
-	 *            The parameter number associated with this object
-	 * @param values
-	 *            The array to place the converted object into
-	 */
-	void convertObjectToSQL2(Locale locale, TrafT4Statement pstmt, Object paramValue, int paramRowCount, int paramNumber,
-			byte[] values, int rowNumber) throws SQLException {
-		byte[] tmpBarray = null;
-		int i;
-		BigDecimal tmpbd;
-		
-		int precision = pstmt.inputDesc_[paramNumber].precision_;
-		int scale = pstmt.inputDesc_[paramNumber].scale_;
-		int sqlDatetimeCode = pstmt.inputDesc_[paramNumber].sqlDatetimeCode_;
-		int FSDataType = pstmt.inputDesc_[paramNumber].fsDataType_;
-		int OdbcDataType = pstmt.inputDesc_[paramNumber].dataType_;
-		int maxLength = pstmt.inputDesc_[paramNumber].sqlOctetLength_;
-		int dataType = pstmt.inputDesc_[paramNumber].sqlDataType_;
-		int dataCharSet = pstmt.inputDesc_[paramNumber].sqlCharset_;
-		int dataLen;
-
-		// setup the offsets
-		int noNullValue = pstmt.inputDesc_[paramNumber].noNullValue_;
-		int nullValue = pstmt.inputDesc_[paramNumber].nullValue_;
-		int dataLength = pstmt.inputDesc_[paramNumber].maxLen_;
-
-                boolean shortLength = precision < Math.pow(2, 15);
-                int dataOffset = ((shortLength) ? 2 : 4);
-
-		if ((dataType == InterfaceResultSet.SQLTYPECODE_VARCHAR_WITH_LENGTH)
-		 || (dataType == InterfaceResultSet.SQLTYPECODE_BLOB)
-		 || (dataType == InterfaceResultSet.SQLTYPECODE_CLOB)) {
-			dataLength += dataOffset;
-
-			if (dataLength % 2 != 0)
-				dataLength++;
-		}
-
-		noNullValue = (noNullValue * paramRowCount) + (rowNumber * dataLength);
-
-		if (nullValue != -1)
-			nullValue = (nullValue * paramRowCount) + (rowNumber * 2);
-
-		if (paramValue == null) {
-			if (nullValue == -1) {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale,
-						"null_parameter_for_not_null_column", new Integer(paramNumber));
-			}
-
-			// values[nullValue] = -1;
-			Bytes.insertShort(values, nullValue, (short) -1, this.ic_.getByteSwap());
-			return;
-		}
-
-		switch (dataType) {
-		case InterfaceResultSet.SQLTYPECODE_CHAR:
-			if (paramValue == null) {
-				// Note for future optimization. We can probably remove the next
-				// line,
-				// because the array is already initialized to 0.
-				Bytes.insertShort(values, noNullValue, (short) 0, this.ic_.getByteSwap());
-			} else if (paramValue instanceof byte[]) {
-				tmpBarray = (byte[]) paramValue;
-			} else if (paramValue instanceof String) {
-				String charSet = "";
-
-				try {
-					if (this.ic_.getISOMapping() == InterfaceUtilities.SQLCHARSETCODE_ISO88591
-							&& !this.ic_.getEnforceISO() && dataCharSet == InterfaceUtilities.SQLCHARSETCODE_ISO88591)
-						charSet = ic_.t4props_.getISO88591();
-					else
-					{
-						if(dataCharSet == InterfaceUtilities.SQLCHARSETCODE_UNICODE && this.ic_.getByteSwap())
-							charSet = "UTF-16LE";
-						else
-							charSet = InterfaceUtilities.getCharsetName(dataCharSet);
-					}
-					tmpBarray = ((String) paramValue).getBytes(charSet);
-				} catch (Exception e) {
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-							charSet);
-				}
-			} // end if (paramValue instanceof String)
-			else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_parameter_value",
-						"CHAR data should be either bytes or String for column: " + paramNumber);
-			}
-
-			//
-			// We now have a byte array containing the parameter
-			//
-
-			dataLen = tmpBarray.length;
-			if (maxLength >= dataLen) {
-				System.arraycopy(tmpBarray, 0, values, noNullValue, dataLen);
-				// Blank pad for rest of the buffer
-				if (maxLength > dataLen) {
-					if (dataCharSet == InterfaceUtilities.SQLCHARSETCODE_UNICODE) {
-						// pad with Unicode spaces (0x00 0x32)
-						int i2 = dataLen;
-						while (i2 < maxLength) {
-							values[noNullValue + i2] = (byte) ' ';
-							values[noNullValue + (i2 + 1)] = (byte) 0 ;
-							i2 = i2 + 2;
-						}
-					} else {
-						Arrays.fill(values, (noNullValue + dataLen), (noNullValue + maxLength), (byte) ' ');
-					}
-				}
-			} else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_string_parameter",
-						"CHAR input data is longer than the length for column: " + paramNumber);
-			}
-
-			break;
-		case InterfaceResultSet.SQLTYPECODE_VARCHAR:
-			if (paramValue instanceof byte[]) {
-				tmpBarray = (byte[]) paramValue;
-			} else if (paramValue instanceof String) {
-				String charSet = "";
-
-				try {
-					if (this.ic_.getISOMapping() == InterfaceUtilities.SQLCHARSETCODE_ISO88591
-							&& !this.ic_.getEnforceISO() && dataCharSet == InterfaceUtilities.SQLCHARSETCODE_ISO88591)
-						charSet = ic_.t4props_.getISO88591();
-					else
-					{
-						if(dataCharSet == InterfaceUtilities.SQLCHARSETCODE_UNICODE && this.ic_.getByteSwap())
-							charSet = "UTF-16LE";
-						else
-							charSet = InterfaceUtilities.getCharsetName(dataCharSet);
-					}
-					tmpBarray = ((String) paramValue).getBytes(charSet);
-				} catch (Exception e) {
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-							charSet);
-				}
-
-			} // end if (paramValue instanceof String)
-			else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_parameter_value",
-						"VARCHAR data should be either bytes or String for column: " + paramNumber);
-			}
-
-			dataLen = tmpBarray.length;
-			if (maxLength > dataLen) {
-				Bytes.insertShort(values, noNullValue, (short) dataLen, this.ic_.getByteSwap());
-				System.arraycopy(tmpBarray, 0, values, noNullValue + 2, dataLen);
-			} else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_parameter_value",
-						"VARCHAR input data is longer than the length for column: " + paramNumber);
-			}
-			break;
-		case InterfaceResultSet.SQLTYPECODE_DATETIME:
-			Date tmpdate = null;
-			switch (sqlDatetimeCode) {
-			case InterfaceResultSet.SQLDTCODE_DATE:
-				try {
-					if (((String) paramValue)
-							.matches("(\\d{4}-\\d{1,2}-\\d{1,2})|(\\d{1,2}\\.\\d{1,2}\\.\\d{4})|(\\d{1,2}/\\d{1,2}/\\d{4})")) {
-						tmpdate = Date.valueOf((String) ((String) paramValue)
-								.replaceFirst("(\\d{1,2})\\.(\\d{1,2})\\.(\\d{4})",	"$3-$2-$1")
-								.replaceFirst("(\\d{1,2})/(\\d{1,2})/(\\d{4})",	"$3-$1-$2"));
-					}else{
-						throw new IllegalArgumentException();
-					}
-				} catch (IllegalArgumentException iex) {
-					throw HPT4Messages
-							.createSQLException(
-									pstmt.connection_.props_,
-									locale,
-									"invalid_parameter_value",
-									"["+paramValue+"] Date format is incorrect or date value is invalide. "
-											+ "  Supported format: YYYY-MM-DD, MM/DD/YYYY, DD.MM.YYYY");
-				}
-				try {
-					byte[] temp1 = tmpdate.toString().getBytes("ASCII");
-					System.arraycopy(temp1, 0, values, noNullValue, temp1.length);
-				} catch (java.io.UnsupportedEncodingException e) {
-					Object[] messageArguments = new Object[1];
-					messageArguments[0] = e.getMessage();
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-							messageArguments);
-				}
-				break;
-			case InterfaceResultSet.SQLDTCODE_TIMESTAMP:
-				Timestamp tmpts;
-				try {
-					tmpts = Timestamp.valueOf((String) paramValue);
-				} catch (IllegalArgumentException iex) {
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_parameter_value",
-							"Timestamp data format is incorrect for column: " + paramNumber + " = " + paramValue);
-				}
-
-				// ODBC precision is nano secs. JDBC precision is micro secs
-				// so substract 3 from ODBC precision.
-				maxLength = maxLength - 3;
-				try {
-					tmpBarray = tmpts.toString().getBytes("ASCII");
-				} catch (java.io.UnsupportedEncodingException e) {
-					Object[] messageArguments = new Object[1];
-					messageArguments[0] = e.getMessage();
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-							messageArguments);
-				}
-				dataLen = tmpBarray.length;
-
-				if (maxLength > dataLen) {
-					System.arraycopy(tmpBarray, 0, values, noNullValue, dataLen);
-
-					// Don't know when we need this. padding blanks. Legacy??
-					Arrays.fill(values, (noNullValue + dataLen), (noNullValue + maxLength), (byte) ' ');
-				} else {
-					System.arraycopy(tmpBarray, 0, values, noNullValue, maxLength);
-				}
-				break;
-			case InterfaceResultSet.SQLDTCODE_TIME:
-				// If the OdbcDataType is equal to Types.Other, that means
-				// that this is HOUR_TO_FRACTION and should be treated
-				// as a Type.Other --> see in SQLDesc.java
-				if (OdbcDataType != java.sql.Types.OTHER) // do the processing
-				// for TIME
-				{
-					Time tmptime;
-					try {
-						if (paramValue instanceof byte[]) {
-							tmptime = Time.valueOf(new String((byte[]) paramValue, "ASCII"));
-						} else {
-							tmptime = Time.valueOf(paramValue.toString());
-						}
-						byte[] tempb1 = tmptime.toString().getBytes("ASCII");
-						System.arraycopy(tempb1, 0, values, noNullValue, tempb1.length);
-					} catch (IllegalArgumentException iex) {
-						throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale,
-								"invalid_parameter_value", "Time data format is incorrect for column: " + paramNumber
-										+ " = " + paramValue);
-					} catch (java.io.UnsupportedEncodingException e) {
-						Object[] messageArguments = new Object[1];
-						messageArguments[0] = e.getMessage();
-						throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-								messageArguments);
-					}
-					break;
-				} else {
-					// HPT4Desc.SQLDTCODE_HOUR_TO_FRACTION data type!!!
-					// let the next case structure handle it
-				}
-			case HPT4Desc.SQLDTCODE_YEAR:
-			case HPT4Desc.SQLDTCODE_YEAR_TO_MONTH:
-			case HPT4Desc.SQLDTCODE_MONTH:
-			case HPT4Desc.SQLDTCODE_MONTH_TO_DAY:
-			case HPT4Desc.SQLDTCODE_DAY:
-			case HPT4Desc.SQLDTCODE_HOUR:
-			case HPT4Desc.SQLDTCODE_HOUR_TO_MINUTE:
-			case HPT4Desc.SQLDTCODE_MINUTE:
-			case HPT4Desc.SQLDTCODE_MINUTE_TO_SECOND:
-				// case HPT4Desc.SQLDTCODE_MINUTE_TO_FRACTION:
-			case HPT4Desc.SQLDTCODE_SECOND:
-				// case HPT4Desc.SQLDTCODE_SECOND_TO_FRACTION:
-			case HPT4Desc.SQLDTCODE_YEAR_TO_HOUR:
-			case HPT4Desc.SQLDTCODE_YEAR_TO_MINUTE:
-			case HPT4Desc.SQLDTCODE_MONTH_TO_HOUR:
-			case HPT4Desc.SQLDTCODE_MONTH_TO_MINUTE:
-			case HPT4Desc.SQLDTCODE_MONTH_TO_SECOND:
-				// case HPT4Desc.SQLDTCODE_MONTH_TO_FRACTION:
-			case HPT4Desc.SQLDTCODE_DAY_TO_HOUR:
-			case HPT4Desc.SQLDTCODE_DAY_TO_MINUTE:
-			case HPT4Desc.SQLDTCODE_DAY_TO_SECOND:
-				// case HPT4Desc.SQLDTCODE_DAY_TO_FRACTION:
-			default:
-				if (paramValue instanceof String) {
-					try {
-						tmpBarray = ((String) paramValue).getBytes("ASCII");
-					} catch (Exception e) {
-						throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-								"ASCII");
-					}
-				} else if (paramValue instanceof byte[]) {
-					tmpBarray = (byte[]) paramValue;
-				} else {
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale,
-							"invalid_cast_specification", "DATETIME data should be either bytes or String for column: "
-									+ paramNumber);
-				}
-				dataLen = tmpBarray.length;
-				if (maxLength == dataLen) {
-					System.arraycopy(tmpBarray, 0, values, noNullValue, maxLength);
-				} else if (maxLength > dataLen) {
-					System.arraycopy(tmpBarray, 0, values, noNullValue, dataLen);
-
-					// Don't know when we need this. padding blanks. Legacy??
-					Arrays.fill(values, (noNullValue + dataLen), (noNullValue + maxLength), (byte) ' ');
-				} else {
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_parameter_value",
-							"DATETIME data longer than column length: " + paramNumber);
-				}
-				break;
-			}
-			break;
-		case InterfaceResultSet.SQLTYPECODE_INTERVAL:
-			if (paramValue instanceof byte[]) {
-				tmpBarray = (byte[]) paramValue;
-			} else if (paramValue instanceof String) {
-				try {
-					tmpBarray = ((String) paramValue).getBytes("ASCII");
-				} catch (Exception e) {
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-							"ASCII");
-				}
-			} else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_cast_specification",
-						"INTERVAL data should be either bytes or String for column: " + paramNumber);
-			}
-
-			dataLen = tmpBarray.length;
-			if (maxLength >= dataLen) {
-				dataLen = tmpBarray.length;
-				if (maxLength == dataLen) {
-					System.arraycopy(tmpBarray, 0, values, noNullValue, maxLength);
-				} else if (maxLength > dataLen) {
-					System.arraycopy(tmpBarray, 0, values, noNullValue, dataLen);
-
-					// Don't know when we need this. padding blanks. Legacy??
-					Arrays.fill(values, (noNullValue + dataLen), (noNullValue + maxLength), (byte) ' ');
-				}
-			} else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_parameter_value",
-						"INTERVAL data longer than column length: " + paramNumber);
-			}
-
-			break;
-		case InterfaceResultSet.SQLTYPECODE_VARCHAR_WITH_LENGTH:
-		case InterfaceResultSet.SQLTYPECODE_VARCHAR_LONG:
-		case InterfaceResultSet.SQLTYPECODE_BLOB:
-		case InterfaceResultSet.SQLTYPECODE_CLOB:
-			if (paramValue instanceof byte[]) {
-				tmpBarray = (byte[]) paramValue;
-			} else if (paramValue instanceof String) {
-				String charSet = "";
-
-				try {
-					if (this.ic_.getISOMapping() == InterfaceUtilities.SQLCHARSETCODE_ISO88591
-							&& !this.ic_.getEnforceISO() && dataCharSet == InterfaceUtilities.SQLCHARSETCODE_ISO88591)
-						charSet = ic_.t4props_.getISO88591();
-					else
-					{
-						if(dataCharSet == InterfaceUtilities.SQLCHARSETCODE_UNICODE && this.ic_.getByteSwap())
-							charSet = "UTF-16LE";
-						else
-							charSet = InterfaceUtilities.getCharsetName(dataCharSet);
-					}
-					tmpBarray = ((String) paramValue).getBytes(charSet);
-				} catch (Exception e) {
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-							charSet);
-				}
-			} // end if (paramValue instanceof String)
-			else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_cast_specification",
-						"VARCHAR data should be either bytes or String for column: " + paramNumber);
-			}
-
-			dataLen = tmpBarray.length;
-			if (maxLength > (dataLen + dataOffset)) { 
-				maxLength = dataLen + dataOffset;
-
-                                if (shortLength) {
-				   System.arraycopy(Bytes.createShortBytes((short) dataLen, this.ic_.getByteSwap()), 0, values, noNullValue, dataOffset);
-                                } else {
-				   System.arraycopy(Bytes.createIntBytes((int) dataLen, this.ic_.getByteSwap()), 0, values, noNullValue, dataOffset);
-                                }
-				System.arraycopy(tmpBarray, 0, values, (noNullValue + dataOffset), dataLen);
-			} else {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_string_parameter",
-						"VARCHAR data longer than column length: " + paramNumber);
-			}
-			break;
-		case InterfaceResultSet.SQLTYPECODE_INTEGER:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			if (scale > 0) {
-				tmpbd = tmpbd.movePointRight(scale);
-			}
-
-			// data truncation check
-			if (pstmt.roundingMode_ == BigDecimal.ROUND_UNNECESSARY) {
-				Utility.checkLongTruncation(paramNumber, tmpbd);
-
-			}
-			Utility.checkIntegerBoundary(locale, tmpbd);
-
-			// check boundary condition for Numeric.
-			Utility.checkDecimalBoundary(locale, tmpbd, precision);
-
-			Bytes.insertInt(values, noNullValue, tmpbd.intValue(), this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_INTEGER_UNSIGNED:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			if (scale > 0) {
-				tmpbd = tmpbd.movePointRight(scale);
-			}
-
-			// data truncation check
-			if (pstmt.roundingMode_ == BigDecimal.ROUND_UNNECESSARY) {
-				Utility.checkLongTruncation(paramNumber, tmpbd);
-
-				// range checking
-			}
-			Utility.checkUnsignedIntegerBoundary(locale, tmpbd);
-
-			// check boundary condition for Numeric.
-			Utility.checkDecimalBoundary(locale, tmpbd, precision);
-
-			Bytes.insertInt(values, noNullValue, tmpbd.intValue(), this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_SMALLINT:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			if (scale > 0) {
-				tmpbd = tmpbd.movePointRight(scale);
-			}
-
-			// data truncation check
-			if (pstmt.roundingMode_ == BigDecimal.ROUND_UNNECESSARY) {
-				Utility.checkLongTruncation(paramNumber, tmpbd);
-
-				// range checking
-			}
-			Utility.checkShortBoundary(locale, tmpbd);
-
-			// check boundary condition for Numeric.
-			Utility.checkDecimalBoundary(locale, tmpbd, precision);
-
-			Bytes.insertShort(values, noNullValue, tmpbd.shortValue(), this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_SMALLINT_UNSIGNED:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			if (scale > 0) {
-				tmpbd = tmpbd.movePointRight(scale);
-			}
-
-			// data truncation check
-			if (pstmt.roundingMode_ == BigDecimal.ROUND_UNNECESSARY) {
-				Utility.checkLongTruncation(paramNumber, tmpbd);
-
-				// range checking
-			}
-			Utility.checkSignedShortBoundary(locale, tmpbd);
-
-			// check boundary condition for Numeric.
-			Utility.checkDecimalBoundary(locale, tmpbd, precision);
-
-			Bytes.insertShort(values, noNullValue, tmpbd.shortValue(), this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_LARGEINT:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-
-			if (scale > 0) {
-				tmpbd = tmpbd.movePointRight(scale);
-
-				// check boundary condition for Numeric.
-			}
-			Utility.checkDecimalBoundary(locale, tmpbd, precision);
-			Bytes.insertLong(values, noNullValue, tmpbd.longValue(), this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_DECIMAL:
-		case InterfaceResultSet.SQLTYPECODE_DECIMAL_UNSIGNED:
-
-			// create an parameter with out "."
-			try {
-				tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-				if (scale > 0) {
-					tmpbd = tmpbd.movePointRight(scale);
-
-				}
-
-				tmpbd = Utility.setScale(tmpbd, scale, pstmt.roundingMode_);
-
-				// data truncation check.
-				if (pstmt.roundingMode_ == BigDecimal.ROUND_UNNECESSARY) {
-					Utility.checkLongTruncation(paramNumber, tmpbd);
-
-					// get only the mantissa part
-				}
-				try {
-					tmpBarray = String.valueOf(tmpbd.longValue()).getBytes("ASCII");
-				} catch (java.io.UnsupportedEncodingException e) {
-					Object[] messageArguments = new Object[1];
-					messageArguments[0] = e.getMessage();
-					throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "unsupported_encoding",
-							messageArguments);
-				}
-			} catch (NumberFormatException nex) {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "invalid_parameter_value",
-						"DECIMAL data format incorrect for column: " + paramNumber + ". Error is: " + nex.getMessage());
-			}
-
-			dataLen = tmpBarray.length;
-
-			// pad leading zero's if datalen < maxLength
-			int desPos = 0;
-			int srcPos = 0;
-			boolean minus = false;
-
-			// check if data is negative.
-			if (tmpbd.signum() == -1) {
-				minus = true;
-				srcPos++;
-				dataLen--;
-			}
-
-			// pad beginning 0 for empty space.
-			int numOfZeros = maxLength - dataLen;
-
-			// DataTruncation is happening.
-			if (numOfZeros < 0) {
-				throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "data_truncation_exceed", new int[]{dataLen, maxLength});
-			}
-
-			for (i = 0; i < numOfZeros; i++) {
-				values[noNullValue + desPos] = (byte) '0';
-				desPos = desPos + 1;
-			}
-			System.arraycopy(tmpBarray, srcPos, values, noNullValue + desPos, dataLen);
-
-			// handling minus sign in decimal. OR -80 with the first byte for
-			// minus
-			if (minus) {
-				values[noNullValue] = (byte) ((byte) (-80) | values[noNullValue]);
-			}
-			break;
-		case InterfaceResultSet.SQLTYPECODE_REAL:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			Utility.checkFloatBoundary(locale, tmpbd);
-			float fvalue = tmpbd.floatValue();
-			int bits = Float.floatToIntBits(fvalue);
-
-			Bytes.insertInt(values, noNullValue, bits, this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_FLOAT:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			Utility.checkFloatBoundary(locale, tmpbd);
-			Bytes.insertLong(values, noNullValue, Double.doubleToLongBits(tmpbd.doubleValue()), this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_DOUBLE:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			Utility.checkDoubleBoundary(locale, tmpbd);
-			Bytes.insertLong(values, noNullValue, Double.doubleToLongBits(tmpbd.doubleValue()), this.ic_.getByteSwap());
-			break;
-		case InterfaceResultSet.SQLTYPECODE_NUMERIC:
-		case InterfaceResultSet.SQLTYPECODE_NUMERIC_UNSIGNED:
-			tmpbd = Utility.getBigDecimalValue(locale, paramValue);
-			byte[] b = InterfaceUtilities.convertBigDecimalToSQLBigNum(tmpbd, maxLength, scale);
-			System.arraycopy(b, 0, values, noNullValue, maxLength);
-			break;
-		// You will not get this type, since server internally converts it
-		// SMALLINT, INTERGER or LARGEINT
-		case InterfaceResultSet.SQLTYPECODE_DECIMAL_LARGE:
-		case InterfaceResultSet.SQLTYPECODE_DECIMAL_LARGE_UNSIGNED:
-		case InterfaceResultSet.SQLTYPECODE_BIT:
-		case InterfaceResultSet.SQLTYPECODE_BITVAR:
-		case InterfaceResultSet.SQLTYPECODE_BPINT_UNSIGNED:
-		default:
-			if (ic_.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-				Object p[] = T4LoggingUtilities.makeParams(stmt_.connection_.props_, locale, pstmt, paramValue,
-						paramNumber);
-				String temp = "Restricted_Datatype_Error";
-				ic_.t4props_.t4Logger_.logp(Level.FINEST, "InterfaceStatement", "convertObjectToSQL2", temp, p);
-			}
-
-			throw HPT4Messages.createSQLException(pstmt.connection_.props_, locale, "restricted_data_type", null);
-		}
-		if (ic_.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-			Object p[] = T4LoggingUtilities
-					.makeParams(stmt_.connection_.props_, locale, pstmt, paramValue, paramNumber);
-			String temp = "datatype = " + dataType;
-			ic_.t4props_.t4Logger_.logp(Level.FINEST, "InterfaceStatement", "convertObjectToSQL2", temp, p);
-		}
-
-	} // end convertObjectToSQL2
-
-	private SQLWarningOrError[] mergeErrors(SQLWarningOrError[] client, SQLWarningOrError[] server) {
-		SQLWarningOrError[] target = new SQLWarningOrError[client.length + server.length];
-
-		int si = 0; // server index
-		int ci = 0; // client index
-		int ti = 0; // target index
-
-		int sr; // server rowId
-		int cr; // client rowId
-
-		int so = 0; // server offset
-
-		while (ci < client.length && si < server.length) {
-			cr = client[ci].rowId;
-			sr = server[si].rowId + so;
-
-			if (cr <= sr || server[si].rowId == 0) {
-				so++;
-				target[ti++] = client[ci++];
-			} else {
-				server[si].rowId += so;
-				target[ti++] = server[si++];
-			}
-		}
-
-		// we only have one array left
-		while (ci < client.length) {
-			target[ti++] = client[ci++];
-		}
-
-		while (si < server.length) {
-			if (server[si].rowId != 0)
-				server[si].rowId += so;
-			target[ti++] = server[si++];
-		}
-
-		return target;
-	}
-
-	SQL_DataValue_def fillInSQLValues2(Locale locale, TrafT4Statement stmt, int paramRowCount, int paramCount,
-			Object[] paramValues, ArrayList clientErrors) throws SQLException
-
-	{
-		SQL_DataValue_def dataValue = new SQL_DataValue_def();
-
-		if (paramRowCount == 0 && paramValues != null && paramValues.length > 0)
-			paramRowCount = 1; // fake a single row if we are doing inputParams
-		// for an SPJ
-
-		// TODO: we should really figure out WHY this could happen
-		if (stmt.inputParamsLength_ < 0) {
-			dataValue.buffer = new byte[0];
-			dataValue.length = 0;
-		} else {
-			int bufLen = stmt.inputParamsLength_ * paramRowCount;
-
-			dataValue.buffer = new byte[bufLen];
-
-			for (int row = 0; row < paramRowCount; row++) {
-				for (int col = 0; col < paramCount; col++) {
-					try {
-						convertObjectToSQL2(locale, stmt, paramValues[row * paramCount + col], paramRowCount, col,
-								dataValue.buffer, row - clientErrors.size());
-					} catch (HPT4Exception e) {
-						if (paramRowCount == 1) // for single rows we need to
-							// throw immediately
-							throw e;
-
-						clientErrors.add(new SQLWarningOrError(row + 1, e.getErrorCode(), e.getMessage(), e
-								.getSQLState()));
-						break; // skip the rest of the row
-					}
-				}
-			}
-
-			// fix the column offsets if we had errors
-			if (clientErrors.size() > 0) {
-				int oldOffset;
-				int newOffset;
-				int noNullValue;
-				int nullValue;
-				int colLength;
-				int dataType;
-
-				for (int i = 1; i < paramCount; i++) // skip the first col
-				{
-					noNullValue = stmt.inputDesc_[i].noNullValue_;
-					nullValue = stmt.inputDesc_[i].nullValue_;
-					colLength = stmt.inputDesc_[i].maxLen_;
-					dataType = stmt.inputDesc_[i].dataType_;
-					if (dataType == InterfaceResultSet.SQLTYPECODE_VARCHAR_WITH_LENGTH
-							|| dataType == InterfaceResultSet.SQLTYPECODE_BLOB
-							|| dataType == InterfaceResultSet.SQLTYPECODE_CLOB
-							|| dataType == InterfaceResultSet.SQLTYPECODE_VARCHAR_LONG
-							|| dataType == InterfaceResultSet.SQLTYPECODE_VARCHAR) {
-                                                boolean shortLength = colLength < Math.pow(2, 15);
-                                                int dataOffset = ((shortLength) ? 2 : 4);
-                                                colLength += dataOffset;
-
-						if (colLength % 2 != 0)
-							colLength++;
-					}
-
-					if (nullValue != -1) {
-						oldOffset = nullValue * paramRowCount;
-						newOffset = oldOffset - (nullValue * clientErrors.size());
-						System.arraycopy(dataValue.buffer, oldOffset, dataValue.buffer, newOffset,
-								2 * (paramRowCount - clientErrors.size()));
-					}
-
-					oldOffset = noNullValue * paramRowCount;
-					newOffset = oldOffset - (noNullValue * clientErrors.size());
-					System.arraycopy(dataValue.buffer, oldOffset, dataValue.buffer, newOffset, colLength
-							* (paramRowCount - clientErrors.size()));
-				}
-			}
-
-			dataValue.length = stmt.inputParamsLength_ * (paramRowCount - clientErrors.size());
-		}
-		return dataValue;
-	}
-
-	boolean hasParameters(String sql) {
-		boolean foundParam = false;
-
-		String[] s = sql.split("\"[^\"]*\"|'[^']*'");
-		for (int i = 0; i < s.length; i++) {
-			if (s[i].indexOf('?') != -1) {
-				foundParam = true;
-				break;
-			}
-		}
-
-		return foundParam;
-	}
-	
-	/**
-	 * Get the transaction status
-	 * 
-	 * @param sql
-	 * @return
-	 */
-	private short getTransactionStatus(String sql) {
-		String tokens[] = sql.split("[^a-zA-Z]+", 3);
-		short rt1 = 0;
-		if (tokens.length > 1 && tokens[1].equalsIgnoreCase("WORK")) {
-			if (tokens[0].equalsIgnoreCase("BEGIN"))
-				rt1 = TRANSPORT.TYPE_BEGIN_TRANSACTION;
-		} else if (tokens[0].equalsIgnoreCase("COMMIT")
-				|| tokens[0].equalsIgnoreCase("ROLLBACK")) {
-			rt1 = TRANSPORT.TYPE_END_TRANSACTION;
-		}
-		
-		return rt1;
-	}
-	
-	// -------------------------------------------------------------
-	//TODO: this whole function needs to be rewritten
-	short getSqlStmtType(String str) {
-		str=str.replaceAll("\\n"," ");
-		str=str.replaceAll("\\s*/\\*.*?\\*/\\s*", " ").trim();
-
-		// 7708
-		stmtIsLock = false;
-
-		String tokens[] = str.split("[^a-zA-Z]+", 3);
-		short rt1 = TRANSPORT.TYPE_UNKNOWN;
-		String str3 = "";
-
-		if (tokens[0].length() > 0)
-			str3 = tokens[0].toUpperCase();
-		else
-			str3 = tokens[1].toUpperCase();
-
-		if(str3.equals("JOINXATXN")){
-			rt1 = TRANSPORT.TYPE_SELECT;
-		}
-		else if(str3.equals("WMSOPEN")) {
-			rt1 = TRANSPORT.TYPE_QS_OPEN;
-		}
-		else if(str3.equals("WMSCLOSE")) {
-			rt1 = TRANSPORT.TYPE_QS_CLOSE;
-		}
-		else if(str3.equals("CMDOPEN")) {
-			rt1 = TRANSPORT.TYPE_CMD_OPEN;
-		}
-		else if(str3.equals("CMDCLOSE")) {
-			rt1 = TRANSPORT.TYPE_CMD_CLOSE;
-		}
-		else {
-			switch(this.ic_.getMode()) {
-			case InterfaceConnection.MODE_SQL:
-				if ((str3.equals("SELECT")) || (str3.equals("SHOWSHAPE")) || (str3.equals("INVOKE"))
-						|| (str3.equals("SHOWCONTROL")) || (str3.equals("SHOWDDL")) || (str3.equals("EXPLAIN"))
-						|| (str3.equals("SHOWPLAN")) || (str3.equals("REORGANIZE")) || (str3.equals("MAINTAIN"))
-						|| (str3.equals("SHOWLABEL")) || (str3.equals("VALUES"))
-						|| (str3.equals("REORG")) || (str3.equals("SEL")) || (str3.equals("GET")) || (str3.equals("SHOWSTATS"))
-						|| str3.equals("GIVE") || str3.equals("STATUS") || str3.equals("INFO") || str3.equals("LIST")
-						) {
-					rt1 = TRANSPORT.TYPE_SELECT;
-				}
-				else if (str3.equals("UPDATE") || str3.equals("MERGE")) {
-					rt1 = TRANSPORT.TYPE_UPDATE;
-				} else if (str3.equals("DELETE") || str3.equals("STOP") || str3.equals("START")) {
-					rt1 = TRANSPORT.TYPE_DELETE;
-				} else if (str3.equals("INSERT") || str3.equals("INS") || str3.equals("UPSERT")) {
-					if (hasParameters(str)) {
-						rt1 = TRANSPORT.TYPE_INSERT_PARAM;
-					} else {
-						rt1 = TRANSPORT.TYPE_INSERT;
-					}
-				}
-				else if (str3.equals("CREATE")) {
-					rt1 = TRANSPORT.TYPE_CREATE;
-				} else if (str3.equals("GRANT")) {
-					rt1 = TRANSPORT.TYPE_GRANT;
-				} else if (str3.equals("DROP")) {
-					rt1 = TRANSPORT.TYPE_DROP;
-				} else if (str3.equals("CALL")) {
-					rt1 = TRANSPORT.TYPE_CALL;
-				} else if (str3.equals("EXPLAIN")) {
-					rt1 = TRANSPORT.TYPE_EXPLAIN;
-				} else if (str3.equals("INFOSTATS")) {
-					rt1 = TRANSPORT.TYPE_STATS;
-				}
-				break;
-			case InterfaceConnection.MODE_WMS:
-				if (str3.equals("STATUS") || str3.equals("INFO")) {
-					rt1 = TRANSPORT.TYPE_SELECT;
-				}
-				break;
-				/* FROM ODBC
-					if (_strnicmp(token, "STATUS", 6) == 0)
-						m_StmtType = TYPE_SELECT;
-					else if (_strnicmp(token, "CANCEL", 6) == 0)
-						m_StmtType = TYPE_UNKNOWN;
-					else if (_strnicmp(token, "SUSPEND", 7) == 0)
-						m_StmtType = TYPE_UNKNOWN;
-					else if (_strnicmp(token, "RESUME", 6) == 0)
-						m_StmtType = TYPE_UNKNOWN;
-					else if (_strnicmp(token, "ALTPRI", 6) == 0)
-						m_StmtType = TYPE_UNKNOWN;
-					else if (_strnicmp(token, "ADD", 3) == 0)
-						m_StmtType = TYPE_UNKNOWN;
-					else if (_strnicmp(token, "ALTER", 5) == 0)
-						m_StmtType = TYPE_UNKNOWN;
-					else if (_strnicmp(token, "DELETE", 6) == 0)
-						m_StmtType = TYPE_UNKNOWN;
-					else if (_strnicmp(token, "INFO", 4) == 0)
-						m_StmtType = TYPE_SELECT;
-					else
-						m_StmtType = TYPE_UNKNOWN;
-				}*/
-			case InterfaceConnection.MODE_CMD:
-				if (str3.equals("STATUS") || str3.equals("INFO") || str3.equals("LIST")) {
-					rt1 = TRANSPORT.TYPE_SELECT;
-				}
-				else if(str3.equals("ADD") || str3.equals("ALTER")) {
-					rt1 = TRANSPORT.TYPE_INSERT;
-				}
-				else if(str3.equals("DELETE") || str3.equals("STOP") || str3.equals("START")) {
-					rt1 = TRANSPORT.TYPE_DELETE;
-				}
-				break;
-			}
-		}
-		
-		return rt1;
-
-	} // end getSqlStmtType
-
-	// -------------------------------------------------------------
-	long getRowCount() {
-		return rowCount_;
-	}
-
-	// -------------------------------------------------------------
-	void setRowCount(long rowCount) {
-		if (rowCount < 0) {
-			rowCount_ = -1;
-		} else {
-			rowCount_ = rowCount;
-		}
-	}
-
-	// -------------------------------------------------------------
-	static HPT4Desc[] NewDescArray(SQLItemDescList_def desc) {
-		int index;
-		HPT4Desc[] HPT4DescArray;
-		SQLItemDesc_def SQLDesc;
-
-		if (desc.list == null || desc.list.length == 0) {
-			return null;
-		}
-
-		HPT4DescArray = new HPT4Desc[desc.list.length];
-
-		for (index = 0; index < desc.list.length; index++) {
-			SQLDesc = desc.list[index];
-			boolean nullInfo = (((new Byte(SQLDesc.nullInfo)).shortValue()) == 1) ? true : false;
-			boolean signType = (((new Byte(SQLDesc.signType)).shortValue()) == 1) ? true : false;
-			HPT4DescArray[index] = new HPT4Desc(SQLDesc.dataType, (short) SQLDesc.datetimeCode, SQLDesc.maxLen,
-					SQLDesc.precision, SQLDesc.scale, nullInfo, SQLDesc.colHeadingNm, signType, SQLDesc.ODBCDataType,
-					SQLDesc.ODBCPrecision, SQLDesc.SQLCharset, SQLDesc.ODBCCharset, SQLDesc.CatalogName,
-					SQLDesc.SchemaName, SQLDesc.TableName, SQLDesc.dataType, SQLDesc.intLeadPrec, SQLDesc.paramMode);
-		}
-		return HPT4DescArray;
-	}
-
-	// -------------------------------------------------------------
-	static HPT4Desc[] NewDescArray(Descriptor2[] descArray) {
-		int index;
-		HPT4Desc[] HPT4DescArray;
-		Descriptor2 desc;
-
-		if (descArray == null || descArray.length == 0) {
-			return null;
-		}
-
-		HPT4DescArray = new HPT4Desc[descArray.length];
-
-		for (index = 0; index < descArray.length; index++) {
-			desc = descArray[index];
-			boolean nullInfo = false;
-			boolean signType = false;
-
-			if (desc.nullInfo_ != 0) {
-				nullInfo = true;
-			}
-			if (desc.signed_ != 0) {
-				signType = true;
-
-			}
-			HPT4DescArray[index] = new HPT4Desc(desc.noNullValue_, desc.nullValue_, desc.version_, desc.dataType_,
-					(short) desc.datetimeCode_, desc.maxLen_, (short) desc.precision_, (short) desc.scale_, nullInfo,
-					signType, desc.odbcDataType_, desc.odbcPrecision_, desc.sqlCharset_, desc.odbcCharset_,
-					desc.colHeadingNm_, desc.tableName_, desc.catalogName_, desc.schemaName_, desc.headingName_,
-					desc.intLeadPrec_, desc.paramMode_, desc.dataType_, desc.getRowLength());
-		}
-		return HPT4DescArray;
-	}
-
-	// -------------------------------------------------------------
-	// Interface methods
-	void executeDirect(int queryTimeout, TrafT4Statement stmt) throws SQLException {
-		short executeAPI = stmt.getOperationID();
-		byte[] messageBuffer = stmt.getOperationBuffer();
-		GenericReply gr = null;
-
-		gr = t4statement_.ExecuteGeneric(executeAPI, messageBuffer);
-		stmt.operationReply_ = gr.replyBuffer;
-
-		if (ic_.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-			Object p[] = T4LoggingUtilities.makeParams(stmt_.connection_.props_, queryTimeout, stmt);
-			String temp = "Exiting ExecDirect.";
-			ic_.t4props_.t4Logger_.logp(Level.FINEST, "InterfaceStatement", "executeDirect", temp, p);
-		}
-	} // end executeDirect
-
-	// --------------------------------------------------------------------------
-	int close() throws SQLException {
-		int rval = 0;
-		CloseReply cry_ = null;
-		ic_.isConnectionOpen();
-		if (ic_.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-			Object p[] = T4LoggingUtilities.makeParams(stmt_.connection_.props_);
-			String temp = "Closing = " + stmtLabel_;
-			ic_.t4props_.t4Logger_.logp(Level.FINEST, "InterfaceStatement", "close", temp, p);
-		}
-
-		cry_ = t4statement_.Close();
-		switch (cry_.m_p1.exception_nr) {
-		case TRANSPORT.CEE_SUCCESS:
-
-			// ignore the SQLWarning for the static close
-			break;
-		case odbc_SQLSvc_Close_exc_.odbc_SQLSvc_Close_SQLError_exn_:
-			HPT4Messages.throwSQLException(stmt_.connection_.props_, cry_.m_p1.SQLError);
-		default:
-			throw HPT4Messages.createSQLException(stmt_.connection_.props_, ic_.getLocale(), "ids_unknown_reply_error",
-					null);
-		} // end switch
-
-		return cry_.m_p2; // rowsAffected
-	} // end close
-
-	// --------------------------------------------------------------------------
-	void cancel() throws SQLException {
-		ic_.cancel();
-	}
-
-	// --------------------------------------------------------------------------
-	// Interface methods for prepared statement
-	void prepare(String sql, int queryTimeout, TrafT4PreparedStatement pstmt) throws SQLException {
-		int sqlAsyncEnable = 0;
-		this.stmtType_ = this.EXTERNAL_STMT;
-		this.sqlStmtType_ = getSqlStmtType(sql);
-		this.setTransactionStatus(pstmt.connection_, sql);
-		int stmtLabelCharset = 1;
-		String cursorName = pstmt.cursorName_;
-		int cursorNameCharset = 1;
-		String moduleName = pstmt.moduleName_;
-		int moduleNameCharset = 1;
-		long moduleTimestamp = pstmt.moduleTimestamp_;
-		String sqlString = sql;
-		int sqlStringCharset = 1;
-		String stmtOptions = "";
-		int maxRowsetSize = pstmt.getMaxRows();
-
-		byte[] txId;
-
-//3196 - NDCS transaction for SPJ	
-//		if (ic_.t4props_.getSPJEnv())
-//			txId = getUDRTransaction(this.ic_.getByteSwap());
-//		else
-//			txId = Bytes.createIntBytes(0, false);
-		txId = Bytes.createIntBytes(0, false);
-
-		if (sqlStmtType_ == TRANSPORT.TYPE_STATS) {
-			throw HPT4Messages.createSQLException(pstmt.connection_.props_, ic_.getLocale(), "infostats_invalid_error",
-					null);
-		} else if (sqlStmtType_ == TRANSPORT.TYPE_CONFIG) {
-			throw HPT4Messages.createSQLException(pstmt.connection_.props_, ic_.getLocale(),
-					"config_cmd_invalid_error", null);
-		}
-
-		PrepareReply pr = t4statement_.Prepare(sqlAsyncEnable, (short) this.stmtType_, this.sqlStmtType_,
-				pstmt.stmtLabel_, stmtLabelCharset, cursorName, cursorNameCharset, moduleName, moduleNameCharset,
-				moduleTimestamp, sqlString, sqlStringCharset, stmtOptions, maxRowsetSize, txId);
-
-		pr_ = pr;
-		this.sqlQueryType_ = pr.sqlQueryType;
-
-		switch (pr.returnCode) {
-		case TRANSPORT.SQL_SUCCESS:
-		case TRANSPORT.SQL_SUCCESS_WITH_INFO:
-			HPT4Desc[] OutputDesc = InterfaceStatement.NewDescArray(pr.outputDesc);
-			HPT4Desc[] InputDesc = InterfaceStatement.NewDescArray(pr.inputDesc);
-			pstmt.setPrepareOutputs2(InputDesc, OutputDesc, pr.inputNumberParams, pr.outputNumberParams,
-					pr.inputParamLength, pr.outputParamLength, pr.inputDescLength, pr.outputDescLength);
-
-			if (pr.errorList != null && pr.errorList.length > 0) {
-				HPT4Messages.setSQLWarning(stmt_.connection_.props_, pstmt, pr.errorList);
-			}
-
-			this.stmtHandle_ = pr.stmtHandle;
-
-			break;
-
-		case odbc_SQLSvc_Prepare_exc_.odbc_SQLSvc_Prepare_SQLError_exn_:
-
-		default:
-			HPT4Messages.throwSQLException(stmt_.connection_.props_, pr.errorList);
-		}
-
-		if (ic_.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-			Object p[] = T4LoggingUtilities.makeParams(stmt_.connection_.props_, sql, queryTimeout, pstmt);
-			String temp = "Exiting prepare...";
-			ic_.t4props_.t4Logger_.logp(Level.FINEST, "InterfaceStatement", "prepare", temp, p);
-		}
-	};
-
-	// used to keep the same transaction inside an SPJ. we call out to the UDR
-	// server and use their transaction for all executes.
-	byte[] getUDRTransaction(boolean swapBytes) throws SQLException {
-		byte[] ret = null;
-
-		try {
-			// To get references to method
-			InterfaceStatement.LmUtility_class_ = Class.forName("com.tandem.sqlmx.LmUtility");
-			InterfaceStatement.LmUtility_getTransactionId_ = InterfaceStatement.LmUtility_class_.getMethod(
-					"getTransactionId", new Class[] {});
-
-			// To invoke the method
-			short[] tId = (short[]) InterfaceStatement.LmUtility_getTransactionId_.invoke(null, new Object[] {});
-
-			ret = new byte[tId.length * 2];
-
-			for (int i = 0; i < tId.length; i++) {
-				Bytes.insertShort(ret, i * 2, tId[i], swapBytes);
-			}
-		} catch (Exception e) {
-			ic_.t4props_.t4Logger_.logp(Level.FINEST, "InterfaceStatement", "getUDRTransaction",
-					"Error calling UDR for transaction id");
-
-			String s = e.toString() + "\r\n";
-			StackTraceElement[] st = e.getStackTrace();
-
-			for (int i = 0; i < st.length; i++) {
-				s += st[i].toString() + "\r\n";
-			}
-
-			throw new SQLException(s);
-		}
-
-		return ret;
-	}
-
-	// -------------------------------------------------------------------
-	void execute(short executeAPI, int paramRowCount, int paramCount, Object[] paramValues, int queryTimeout
-	// executeDirect
-			, String sql, TrafT4Statement stmt
-
-	) throws SQLException {
-		cursorName_ = stmt.cursorName_;
-		rowCount_ = 0;
-
-		int sqlAsyncEnable = (stmt.getResultSetHoldability() == TrafT4ResultSet.HOLD_CURSORS_OVER_COMMIT) ? 1 : 0;
-		int inputRowCnt = paramRowCount;
-		int maxRowsetSize = stmt.getMaxRows();
-		String sqlString = (sql == null) ? stmt.getSQL() : sql;
-		int sqlStringCharset = 1;
-		int cursorNameCharset = 1;
-		int stmtLabelCharset = 1;
-		byte[] txId;
-		ArrayList clientErrors = new ArrayList();
-
-//3196 - NDCS transaction for SPJ	
-//		if (ic_.t4props_.getSPJEnv())
-//			txId = getUDRTransaction(this.ic_.getByteSwap());
-//		else if (stmt.transactionToJoin != null)
-//			txId = stmt.transactionToJoin;
-//		else if (stmt.connection_.transactionToJoin != null)
-//			txId = stmt.connection_.transactionToJoin;
-//		else
-//			txId = Bytes.createIntBytes(0, false); // 0 length, no data
-		if (stmt.transactionToJoin != null)
-			txId = stmt.transactionToJoin;
-		else if (stmt.connection_.transactionToJoin != null)
-			txId = stmt.connection_.transactionToJoin;
-		else
-			txId = Bytes.createIntBytes(0, false); // 0 length, no data
-
-		SQL_DataValue_def inputDataValue;
-		SQLValueList_def inputValueList = new SQLValueList_def();
-		byte[] inputParams = null;
-
-		if (executeAPI == TRANSPORT.SRVR_API_SQLEXECDIRECT) {
-			sqlStmtType_ = getSqlStmtType(sql);
-			setTransactionStatus(stmt.connection_, sql);
-			stmt.outputDesc_ = null; // clear the output descriptors
-		}
-
-		if (stmt.usingRawRowset_ == true) {
-			executeAPI = TRANSPORT.SRVR_API_SQLEXECUTE2;
-			inputDataValue = new SQL_DataValue_def();
-			inputDataValue.userBuffer = stmt.rowwiseRowsetBuffer_;
-			inputDataValue.length = stmt.rowwiseRowsetBuffer_.limit() - 4;
-
-			if (this.sqlQueryType_ == 16) // use the param values
-			{
-				try {
-					inputRowCnt = Integer.parseInt(paramValues[0].toString());
-					maxRowsetSize = Integer.parseInt(paramValues[1].toString());
-				} catch (Exception e) {
-					throw new SQLException(
-							"Error setting inputRowCnt and maxRowsetSize.  Parameters not set or invalid.");
-				}
-			} else {
-				inputRowCnt = paramRowCount - 1;
-			}
-
-		} else {
-			inputDataValue = fillInSQLValues2(ic_.getLocale(), stmt, inputRowCnt, paramCount, paramValues, clientErrors);
-
-			if (ic_.t4props_.t4Logger_.isLoggable(Level.FINEST) == true) {
-				Object p[] = T4LoggingUtilities.makeParams(stmt_.connection_.props_, paramRowCount, paramCount,
-						paramValues, queryTimeout, stmt);
-				String temp = "invoke ==> Execute2";
-				ic_.t4props_.t4Logger_.logp(Level.FINEST, "InterfaceStatement", "execute", temp, p);
-			}
-		}
-
-		ExecuteReply er = t4statement_.Execute(executeAPI, sqlAsyncEnable, inputRowCnt - clientErrors.size(),
-				maxRowsetSize, this.sqlStmtType_, this.stmtHandle_, sqlString, sqlStringCharset, this.cursorName_,
-				cursorNameCharset, stmt.stmtLabel_, stmtLabelCharset, inputDataValue, inputValueList, txId,
-				stmt.usingRawRowset_);
-
-		if (executeAPI == TRANSPORT.SRVR_API_SQLEXECDIRECT) {
-			this.sqlQueryType_ = er.queryType;
-		}
-
-		if (clientErrors.size() > 0) {
-			if (er.errorList == null)
-				er.errorList = (SQLWarningOrError[]) clientErrors.toArray(new SQLWarningOrError[clientErrors.size()]);
-			else
-				er.errorList = mergeErrors((SQLWarningOrError[]) clientErrors
-						.toArray(new SQLWarningOrError[clientErrors.size()]), er.errorList);
-		}
-
-		stmt_.result_set_offset = 0;
-		rowCount_ = er.rowsAffected;
-		
-		int numStatus;
-		
-		if (stmt_.connection_.props_.getDelayedErrorMode())
-		{
-			if (stmt_._lastCount > 0) {
-				numStatus = stmt_._lastCount;
-			}
-			else {
-				numStatus = inputRowCnt;
-			}
-		}
-		else
-		{
-			numStatus = inputRowCnt;
-		}
-
-	    if (numStatus < 1)
-	    {
-	    	numStatus = 1;
-	    }
-
-	    stmt.batchRowCount_ = new int[numStatus];
-	    boolean batchException = false;	//3164
-
-	    if (stmt_.connection_.props_.getDelayedErrorMode() && stmt_._lastCount < 1) {
-			Arrays.fill(stmt.batchRowCount_, -2); // fill with success
-	    } 
-	    else if (er.returnCode == TRANSPORT.SQL_SUCCESS || er.returnCode == TRANSPORT.SQL_SUCCESS_WITH_INFO
-				|| er.returnCode == TRANSPORT.NO_DATA_FOUND) {
-			Arrays.fill(stmt.batchRowCount_, -2); // fill with success
-			if (er.errorList != null) // if we had errors with valid rowIds,
-			// update the array
-			{
-				for (int i = 0; i < er.errorList.length; i++) {
-					int row = er.errorList[i].rowId - 1;
-					if (row >= 0 && row < stmt.batchRowCount_.length) {
-						stmt.batchRowCount_[row] = -3;
-						batchException = true;	//3164
-					}
-				}
-			}
-			
-			//set the statement mode as the command succeeded
-			if (sqlStmtType_ == TRANSPORT.TYPE_QS_OPEN) {
-				this.ic_.setMode(InterfaceConnection.MODE_WMS);
-			} else if (sqlStmtType_ == TRANSPORT.TYPE_QS_CLOSE) {
-				this.ic_.setMode(InterfaceConnection.MODE_SQL);
-			} else if(sqlStmtType_ == TRANSPORT.TYPE_CMD_OPEN) {
-				this.ic_.setMode(InterfaceConnection.MODE_CMD);
-			} else if(sqlStmtType_ == TRANSPORT.TYPE_CMD_CLOSE) {
-				this.ic_.setMode(InterfaceConnection.MODE_SQL);
-			}
-
-			// set the statement label if we didnt get one back.
-			if (er.stmtLabels == null || er.stmtLabels.length == 0) {
-				er.stmtLabels = new String[1];
-				er.stmtLabels[0] = stmt.stmtLabel_;
-			}
-
-			// get the descriptors from the proper location
-			HPT4Desc[][] desc = null;
-
-			// try from execute data first
-			if (er.outputDesc != null && er.outputDesc.length > 0) {
-				desc = new HPT4Desc[er.outputDesc.length][];
-
-				for (int i = 0; i < er.outputDesc.length; i++) {
-					desc[i] = InterfaceStatement.NewDescArray(er.outputDesc[i]);
-				}
-			}
-			// try from the prepare data
-			else if (stmt.outputDesc_ != null && stmt.outputDesc_.length > 0) {
-				desc = new HPT4Desc[1][];
-				desc[0] = stmt.outputDesc_;
-			}
-
-			if (this.sqlStmtType_ == TRANSPORT.TYPE_CALL) {
-				TrafT4CallableStatement cstmt = (TrafT4CallableStatement) stmt;
-				Object[] outputValueArray;
-				if(er.returnCode == TRANSPORT.NO_DATA_FOUND) { //this should really only happen with LAST0 specified
-					outputValueArray = new Object[cstmt.outputDesc_.length];
-				}
-				else {
-					outputValueArray = InterfaceResultSet.getExecute2Outputs(cstmt.connection_, cstmt.outputDesc_, 
-						er.outValues, this.ic_.getByteSwap());
-				}
-				
-				cstmt.setExecuteCallOutputs(outputValueArray, (short) er.rowsAffected);
-				stmt.setMultipleResultSets(er.numResultSets, desc, er.stmtLabels, er.proxySyntax);
-			} else {
-				// fix until we start returning numResultsets for more than just
-				// SPJs
-				if (desc != null && desc.length > 0 && er.numResultSets == 0) {
-					er.numResultSets = 1;
-				}
-
-				if (er.outValues != null && er.outValues.length > 0) {
-					stmt.setExecute2Outputs(er.outValues, (short) er.rowsAffected, false, er.proxySyntax, desc[0]);
-				} else {
-					stmt.setMultipleResultSets(er.numResultSets, desc, er.stmtLabels, er.proxySyntax);
-				}
-			}
-			if (er.errorList != null) {
-				HPT4Messages.setSQLWarning(stmt_.connection_.props_, stmt, er.errorList);
-			}
-		} else {
-			Arrays.fill(stmt.batchRowCount_, -3); // fill with failed
-			HPT4Messages.throwSQLException(stmt_.connection_.props_, er.errorList);
-		}
-	    //3164
-	    if (batchException) {
-	    	HPT4Messages.throwSQLException(stmt_.connection_.props_, er.errorList);
-	    }
-	}
-
-	protected void setTransactionStatus(TrafT4Connection conn, String sql) {
-		short tranStatus = getTransactionStatus(sql);
-		if(tranStatus == TRANSPORT.TYPE_BEGIN_TRANSACTION){
-			conn.setBeginTransaction(true);
-		}else if (tranStatus == TRANSPORT.TYPE_END_TRANSACTION){
-			conn.setBeginTransaction(false);
-		}
-		
-	}
-} // end class InterfaceStatement

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceUtilities.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceUtilities.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceUtilities.java
deleted file mode 100644
index 95fa7f9..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceUtilities.java
+++ /dev/null
@@ -1,235 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-package org.trafodion.jdbc.t4;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Hashtable;
-
-public class InterfaceUtilities {
-	static private Hashtable valueToCharset;
-	static {
-		valueToCharset = new Hashtable(11);
-		valueToCharset.put(new Integer(1), "ISO8859_1"); // ISO
-		valueToCharset.put(new Integer(10), "MS932"); // SJIS
-		valueToCharset.put(new Integer(11), "UTF-16BE"); // UCS2
-		valueToCharset.put(new Integer(12), "EUCJP"); // EUCJP
-		valueToCharset.put(new Integer(13), "MS950"); // BIG5
-		valueToCharset.put(new Integer(14), "GB18030"); // GB18030
-		valueToCharset.put(new Integer(15), "UTF-8"); // UTF8
-		valueToCharset.put(new Integer(16), "MS949"); // MB_KSC5601
-		valueToCharset.put(new Integer(17), "GB2312"); // GB2312
-	}
-	static private Hashtable charsetToValue;
-	static {
-		charsetToValue = new Hashtable(11);
-		charsetToValue.put("ISO8859_1", new Integer(1)); // ISO
-		charsetToValue.put("MS932", new Integer(10)); // SJIS
-		charsetToValue.put("UTF-16BE", new Integer(11)); // UCS2
-		charsetToValue.put("EUCJP", new Integer(12)); // EUCJP
-		charsetToValue.put("MS950", new Integer(13)); // BIG5
-		charsetToValue.put("GB18030", new Integer(14)); // GB18030
-		charsetToValue.put("UTF-8", new Integer(15)); // UTF8
-		charsetToValue.put("MS949", new Integer(16)); // MB_KSC5601
-		charsetToValue.put("GB2312", new Integer(17)); // GB2312
-	}
-
-	static final int SQLCHARSETCODE_UNKNOWN = 0;
-	static final String SQLCHARSET_UNKNOWN = "UNKNOWN";
-
-	// these are the only real column types
-	static final int SQLCHARSETCODE_ISO88591 = 1;
-	static final String SQLCHARSET_ISO88591 = "ISO88591";
-	static final int SQLCHARSETCODE_UNICODE = 11;
-	static final String SQLCHARSET_UNICODE = "UCS2";
-
-	// ISO_MAPPING values
-	static final int SQLCHARSETCODE_SJIS = 10;
-	static final int SQLCHARSETCODE_UTF8 = 15;
-
-	static String getCharsetName(int charset) {
-		String ret = (String) valueToCharset.get(new Integer(charset));
-
-		if (ret == null)
-			ret = SQLCHARSET_UNKNOWN;
-
-		return ret;
-	}
-
-	static int getCharsetValue(String charset) {
-		Integer i = (Integer) charsetToValue.get(charset);
-		int ret;
-
-		if (i == null)
-			ret = SQLCHARSETCODE_UNKNOWN;
-		else
-			ret = i.intValue();
-
-		return ret;
-	}
-
-	static private final int[] powersOfTen = { 10, 100, 1000, 10000 };
-
-	public static byte[] convertBigDecimalToSQLBigNum(BigDecimal bd, int targetLength, int targetScale) {
-		byte[] sourceData = bd.setScale(targetScale, BigDecimal.ROUND_DOWN).unscaledValue().toString().getBytes(); // add
-																													// trailing
-																													// 0s,
-		// remove decimal point,
-		// get the chars
-		byte[] targetData = new byte[targetLength];
-		int[] targetInShorts = new int[targetLength / 2];
-
-		int length;
-		int temp;
-		int tarPos = 1;
-
-		// remove leading 0s and sign character
-		int zeros = 0;
-		while (zeros < sourceData.length && (sourceData[zeros] == '0' || sourceData[zeros] == '-'))
-			zeros++;
-
-		// convert from characters to values
-		for (int i = zeros; i < sourceData.length; i++)
-			sourceData[i] -= '0';
-
-		length = sourceData.length - zeros; // we have a new length
-
-		// iterate through 4 bytes at a time
-		for (int i = 0; i < length; i += 4) {
-			int temp1 = 0;
-			int j = 0;
-
-			// get 4 bytes worth of data or as much that is left
-			for (j = 0; j < 4 && i + j < length; j++)
-				temp1 = temp1 * 10 + sourceData[zeros + i + j];
-
-			int power = powersOfTen[j - 1]; // get the power of ten based on how
-			// many digits we got
-
-			temp = targetInShorts[0] * power + temp1; // move the current
-			// digits over and then
-			// add our new value in
-			targetInShorts[0] = temp & 0xFFFF; // we save only up to 16bits --
-			// the rest gets carried over
-
-			// we do the same thing for the rest of the digits now that we have
-			// an upper bound
-			for (j = 1; j < targetInShorts.length; j++) {
-				int t = (temp & 0xFFFF0000) >> 16;
-				temp = targetInShorts[j] * power + t;
-
-				targetInShorts[j] = temp & 0xFFFF;
-			}
-
-			int carry = (temp & 0xFFFF0000) >> 16;
-			if (carry > 0) {
-				targetInShorts[tarPos++] = carry;
-			}
-		}
-
-		// convert the data back to bytes
-		for (int i = 0; i < targetInShorts.length; i++) {
-//			targetData[i * 2] = (byte) ((targetInShorts[i] & 0xFF00) >> 8);
-//			targetData[i * 2 + 1] = (byte) (targetInShorts[i] & 0xFF);
-			targetData[i * 2 ] = (byte) (targetInShorts[i] & 0xFF);
-			targetData[i * 2 + 1] = (byte) ((targetInShorts[i] & 0xFF00) >> 8);
-		}
-
-		// add sign
-		if ((bd.signum() < 0))
-			targetData[targetData.length - 2] |= 0x80;
-
-		return targetData;
-	}
-
-	public static BigDecimal convertSQLBigNumToBigDecimal(byte[] sourceData, int scale, boolean swap) {
-		String strVal = ""; // our final String
-
-		// we need the data in an array which can hold UNSIGNED 16 bit values
-		// in java we dont have unsigned datatypes so 32-bit signed is the best
-		// we can do
-		int[] dataInShorts = new int[sourceData.length / 2];
-		for (int i = 0; i < dataInShorts.length; i++)
-			dataInShorts[i] = Bytes.extractUShort(sourceData, i * 2, swap); // copy
-		// the
-		// data
-		
-		boolean negative = ((dataInShorts[dataInShorts.length - 1] & 0x8000) > 0);
-		dataInShorts[dataInShorts.length - 1] &= 0x7FFF; // force sign to 0, continue
-		// normally
-
-		int curPos = dataInShorts.length - 1; // start at the end
-		while (curPos >= 0 && dataInShorts[curPos] == 0)
-			// get rid of any trailing 0's
-			curPos--;
-
-		int remainder = 0;
-		long temp; // we need to use a LONG since we will have to hold up to
-		// 32-bit UNSIGNED values
-
-		// we now have the huge value stored in 2 bytes chunks
-		// we will divide by 10000 many times, converting the remainder to
-		// String
-		// when we are left with a single chunk <10000 we will handle it using a
-		// special case
-		while (curPos >= 0 || dataInShorts[0] >= 10000) {
-			// start on the right, divide the 16 bit value by 10000
-			// use the remainder as the upper 16 bits for the next division
-			for (int j = curPos; j >= 0; j--) {
-				// these operations got messy when java tried to infer what size
-				// to store the value in
-				// leave these as separate operations for now...always casting
-				// back to a 64 bit value to avoid sign problems
-				temp = remainder;
-				temp &= 0xFFFF;
-				temp = temp << 16;
-				temp += dataInShorts[j];
-
-				dataInShorts[j] = (int) (temp / 10000);
-				remainder = (int) (temp % 10000);
-			}
-
-			// if we are done with the current 16bits, move on
-			if (dataInShorts[curPos] == 0)
-				curPos--;
-
-			// go through the remainder and add each digit to the final String
-			for (int j = 0; j < 4; j++) {
-				strVal = (remainder % 10) + strVal;
-				remainder /= 10;
-			}
-		}
-
-		// when we finish the above loop we still have 1 <10000 value to include
-		remainder = dataInShorts[0];
-		for (int j = 0; j < 4; j++) {
-			strVal = (remainder % 10) + strVal;
-			remainder /= 10;
-		}
-
-		BigInteger bi = new BigInteger(strVal); // create a java BigInt
-		if (negative)
-			bi = bi.negate();
-
-		return new BigDecimal(bi, scale); // create a new BigDecimal with the
-		// descriptor's scale
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Key.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Key.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Key.java
deleted file mode 100644
index b143866..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Key.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-//
-**********************************************************************/
-
-/**
- * Key.java
- */
-
-package org.trafodion.jdbc.t4;
-
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.security.cert.X509Certificate;
-import java.security.KeyFactory;
-import java.security.interfaces.RSAPublicKey;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.InvalidKeySpecException;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
-import javax.crypto.KeyGenerator;
-
-
-public class Key {
-	public Key(){}
-
-	/** Reads the public key from the certificate file and
-	 *  stores the key and the length of the public key
-	 *  in member data.
-	 *  @param X509Certificate - The certificate stored
-	 *  the public key
-	 */
-   public void getPubKeyFromFile(X509Certificate cert)
-   {
-      m_pubKey = (RSAPublicKey) cert.getPublicKey();
-      if (((m_pubKey.getModulus().bitLength()) / 8) > 128)
-    	  m_pubKeyLen = 256;
-      else
-    	  m_pubKeyLen = 128;
-   }
-
-   /** Reads the private key from certificate file and
-    *  stores the key in the member data.
-    *  @param String - The file stored the private key
-    *  @throw SecurityException
-    */
-   public void getPrivKeyFromFile(String inFile) throws SecurityException
-   {
-      InputStream inStream=null;
-
-      try{
-         // Loading private key file
-         inStream=new FileInputStream(inFile);
-         byte[] keyBytes=new byte[inStream.available()];
-         inStream.read(keyBytes);
-         inStream.close();
-
-         // Read the private key from file
-         PKCS8EncodedKeySpec privKeySpec=new PKCS8EncodedKeySpec(keyBytes);
-         KeyFactory keyFactory = KeyFactory.getInstance("RSA");
-         m_privKey= (RSAPrivateKey) keyFactory.generatePrivate
-                                                       (privKeySpec);
-
-      }catch (FileNotFoundException fnf) {
-         throw new SecurityException(SecClientMsgKeys.FILE_NOTFOUND, new Object[]{inFile});
-      }catch (IOException io) {
-         throw new SecurityException(SecClientMsgKeys.ERR_OPEN_INPUT_FILE, new Object[]{inFile});
-      }catch (Exception e) {
-         throw new SecurityException(SecClientMsgKeys.ERR_RETRIEVE_KEY_FROM_FILE, new Object[]{inFile});
-      }finally {
-         try {
-            if (inStream != null)
-               inStream.close();
-         }catch (IOException io) {
-            // not much we can do at this point
-         }
-      }
-   }
-
-   /**
-    * Generates a secret key using AES algorithm and 128 bits key
-    * @param sessionKey the session key byte array used for symmetric key
-    *                   generation
-    * @return the SecretKey
-    * @throws SecurityException
-    */
-   static SecretKey generateSymmetricKey(byte [] sKey) throws SecurityException
-   {
-	  if (sKey == null)
-		  throw new SecurityException(SecClientMsgKeys.INPUT_PARAMETER_IS_NULL, new Object[]{"sKey"});
-	  try {
-         // Get the KeyGenerator
-         KeyGenerator kgen = KeyGenerator.getInstance("AES");
-         synchronized(kgen) {
-        	 kgen.init(128);
-         }
-         // Use the lower 16 bytes of the session key to generate the 128 bits secret
-         // key used for data encryption
-
-         SecretKey skey = new SecretKeySpec(sKey, kgen.getAlgorithm());
-
-         return skey;
-	  }catch (NoSuchAlgorithmException nae) {
-		  throw new SecurityException(SecClientMsgKeys.ERR_CREATE_SYMMETRIC_KEY, null);
-	  }
-   }
-
-   /**
-    *
-    * @return the public key
-    */
-   public RSAPublicKey getPubKey()
-   {
-      return m_pubKey;
-   }
-
-   /**
-    *
-    * @return the private key
-    */
-   public RSAPrivateKey getPrivKey()
-   {
-      return m_privKey;
-   }
-
-   /**
-    *
-    * @return the length of the public key
-    */
-   public int getPubKeyLen()
-   {
-      return m_pubKeyLen;
-   }
-
-   private RSAPublicKey m_pubKey;
-   private RSAPrivateKey m_privKey;
-   private int m_pubKeyLen;
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/LogicalByteArray.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/LogicalByteArray.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/LogicalByteArray.java
deleted file mode 100644
index ce0e3ac..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/LogicalByteArray.java
+++ /dev/null
@@ -1,345 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.ByteBuffer;
-
-class LogicalByteArray {
-	static private java.lang.ThreadLocal threadArray = new java.lang.ThreadLocal();
-
-	private byte[] array;
-	private ByteBuffer dataBuffer;
-	private byte[] trailer;
-
-	private boolean swap; // should we swap byte order
-	private int loc; // current position
-	private int length; // current bytes being used
-
-	LogicalByteArray(int size, int startingLoc, boolean byteSwap) {
-		loc = startingLoc;
-		length = 0;
-		swap = byteSwap;
-
-		// TRANSPORT.IO_BUFFER_LENGTH is our minimum length so it is always safe
-		// to read with the buffer
-		resize((size > TRANSPORT.IO_BUFFER_LENGTH) ? size : TRANSPORT.IO_BUFFER_LENGTH);
-	}
-
-	void resize(long l) {
-		byte[] old = (byte[]) threadArray.get();
-
-		if (old == null || old.length < l) {
-			array = new byte[(int) l];
-			if (old != null)
-				System.arraycopy(old, 0, array, 0, old.length);
-
-			threadArray.set(array);
-		} else {
-			array = old;
-		}
-	}
-
-	void reset() {
-		length = 0;
-		loc = 0;
-	}
-
-	byte[] getBuffer() {
-		return array;
-	}
-
-	int getTotalAllocated() {
-		return array.length;
-	}
-
-	int getLength() {
-		if (length < loc) {
-			length = loc;
-		}
-
-		return length;
-	}
-
-	int getLocation() {
-		return loc;
-	}
-
-	public void setLocation(int newLoc) {
-		if (newLoc > length) {
-			length = newLoc;
-		}
-
-		loc = newLoc;
-	}
-
-	void insertByte(byte value) {
-		array[loc++] = value;
-	}
-
-	void insertByteArray(byte[] value, int len) {
-		System.arraycopy(value, 0, array, loc, len);
-
-		loc += len;
-	}
-
-	void insertChar(char value) {
-		array[loc++] = (byte) value;
-	}
-
-	void insertShort(short value) {
-		if (swap) {
-			array[loc + 1] = (byte) ((value >>> 8) & 0xff);
-			array[loc] = (byte) ((value) & 0xff);
-		} else {
-			array[loc] = (byte) ((value >>> 8) & 0xff);
-			array[loc + 1] = (byte) ((value) & 0xff);
-		}
-
-		loc += 2;
-	}
-
-	void insertInt(int value) {
-		if (swap) {
-			array[loc + 3] = (byte) ((value >>> 24) & 0xff);
-			array[loc + 2] = (byte) ((value >>> 16) & 0xff);
-			array[loc + 1] = (byte) ((value >>> 8) & 0xff);
-			array[loc] = (byte) ((value) & 0xff);
-		} else {
-			array[loc] = (byte) ((value >>> 24) & 0xff);
-			array[loc + 1] = (byte) ((value >>> 16) & 0xff);
-			array[loc + 2] = (byte) ((value >>> 8) & 0xff);
-			array[loc + 3] = (byte) ((value) & 0xff);
-		}
-
-		loc += 4;
-	}
-
-	void insertLong(long value) {
-		if (swap) {
-			array[loc + 7] = (byte) ((value >>> 56) & 0xff);
-			array[loc + 6] = (byte) ((value >>> 48) & 0xff);
-			array[loc + 5] = (byte) ((value >>> 40) & 0xff);
-			array[loc + 4] = (byte) ((value >>> 32) & 0xff);
-			array[loc + 3] = (byte) ((value >>> 24) & 0xff);
-			array[loc + 2] = (byte) ((value >>> 16) & 0xff);
-			array[loc + 1] = (byte) ((value >>> 8) & 0xff);
-			array[loc] = (byte) ((value) & 0xff);
-		} else {
-			array[loc] = (byte) ((value >>> 56) & 0xff);
-			array[loc + 1] = (byte) ((value >>> 48) & 0xff);
-			array[loc + 2] = (byte) ((value >>> 40) & 0xff);
-			array[loc + 3] = (byte) ((value >>> 32) & 0xff);
-			array[loc + 4] = (byte) ((value >>> 24) & 0xff);
-			array[loc + 5] = (byte) ((value >>> 16) & 0xff);
-			array[loc + 6] = (byte) ((value >>> 8) & 0xff);
-			array[loc + 7] = (byte) ((value) & 0xff);
-		}
-
-		loc += 8;
-	}
-
-	void insertStringWithCharset(byte[] str, int charset) {
-		if (str != null && str.length > 0) {
-			this.insertString(str);
-			this.insertInt(charset);
-		} else {
-			this.insertInt(0);
-		}
-	}
-	
-	void insertFixedString(byte[] buf, int len) {
-		int dataLength;
-		
-		if(buf != null) {
-			dataLength = (buf.length > len-1)?len-1:buf.length; //-1 for the null, max dataLength is (len-1)
-			this.insertByteArray(buf, dataLength);
-		} else {
-			dataLength = 0;
-		}
-		
-		byte [] padding = new byte[len-dataLength]; //this will always be at least 1 for the null padding
-		this.insertByteArray(padding, padding.length);
-	}
-
-	void insertString(byte[] buf) {
-		if (buf != null && buf.length > 0) {
-			this.insertInt(buf.length + 1);
-			this.insertByteArray(buf, buf.length);
-			this.insertByte((byte) 0);
-		} else { // buffer is null or length 0
-			this.insertInt(0);
-		}
-	}
-
-	void insertString(byte[] str, boolean fixForServer) {
-		if (str != null && str.length > 0) {
-			this.insertInt(str.length + 1); // +1 null term
-			this.insertByteArray(str, str.length);
-			this.insertByte((byte) 0);
-		} else {
-			this.insertInt(1);
-			this.insertByte((byte) 0);
-		}
-	}
-
-	// /////////////////////////////////////////////////////////////////
-	// /////////////////////////////////////////////////////////////////
-
-	boolean extractBoolean() {
-		return (extractByte() == 0) ? false : true;
-	}
-
-	byte extractByte() {
-		return array[loc++];
-	}
-
-	byte[] extractByteArray(long bufferLength) {
-		byte[] a = new byte[(int) bufferLength];
-
-		System.arraycopy(array, loc, a, 0, (int) bufferLength);
-		loc += bufferLength;
-
-		return a;
-	}
-
-	byte[] extractByteArray() {
-		return extractByteArray(this.extractInt());
-	}
-
-	char extractChar() {
-		return (char) extractByte();
-	}
-
-	short extractShort() {
-		int value;
-
-		if (swap) {
-			value = ((array[loc]) & 0x00ff) | ((array[loc + 1] << 8) & 0xff00);
-		} else {
-			value = ((array[loc + 1]) & 0x00ff) | ((array[loc] << 8) & 0xff00);
-		}
-
-		loc += 2;
-
-		return (short) value;
-	}
-
-	int extractInt() {
-		int value;
-
-		if (swap) {
-			value = ((array[loc]) & 0x000000ff) | ((array[loc + 1] << 8) & 0x0000ff00)
-					| ((array[loc + 2] << 16) & 0x00ff0000) | ((array[loc + 3] << 24) & 0xff000000);
-		} else {
-			value = ((array[loc + 3]) & 0x000000ff) | ((array[loc + 2] << 8) & 0x0000ff00)
-					| ((array[loc + 1] << 16) & 0x00ff0000) | ((array[loc] << 24) & 0xff000000);
-		}
-
-		loc += 4;
-
-		return value;
-	}
-	
-	long extractLong() {
-		long value;
-
-		if (swap) {
-			value = ((array[loc]) & 0x00000000000000ffL) | ((array[loc + 1] << 8) & 0x000000000000ff00L)
-					| ((array[loc + 2] << 16) & 0x0000000000ff0000L) | ((array[loc + 3] << 24) & 0x00000000ff000000L)
-					| ((array[loc + 4] << 32) & 0x000000ff00000000L) | ((array[loc + 5] << 40) & 0x0000ff0000000000L)
-					| ((array[loc + 6] << 48) & 0x00ff000000000000L) | ((array[loc + 7] << 56) & 0xff00000000000000L);
-		} else {
-			value = ((array[loc + 7]) & 0x00000000000000ffL) | ((array[loc + 6] << 8) & 0x000000000000ff00L)
-					| ((array[loc + 5] << 16) & 0x0000000000ff0000L) | ((array[loc + 4] << 24) & 0x00000000ff000000L)
-					| ((array[loc + 3] << 32) & 0x000000ff00000000L) | ((array[loc + 2] << 40) & 0x0000ff0000000000L)
-					| ((array[loc + 1] << 48) & 0x00ff000000000000L) | ((array[loc] << 56) & 0xff00000000000000L);
-		}
-
-		loc += 8;
-
-		return value;
-	}
-
-	long extractUnsignedInt() {
-		long value;
-		
-		if(swap) {
-			value = ((array[loc]) & 0x000000ff) | ((array[loc + 1] << 8) & 0x0000ff00)
-				| ((array[loc + 2] << 16) & 0x00ff0000) | ((array[loc + 3] << 24) & 0xff000000);
-		} else {
-			value = ((array[loc + 3]) & 0x000000ff) | ((array[loc + 2] << 8) & 0x0000ff00)
-			| ((array[loc + 1] << 16) & 0x00ff0000) | ((array[loc] << 24) & 0xff000000);
-		}
-		
-		loc += 4;
-
-		return value & 0xffffffffL;
-	}
-
-	byte[] extractString() {
-		int len = extractInt();
-		byte[] str = new byte[0];
-
-		if (len > 0) {
-			str = extractByteArray(len - 1);
-			extractByte(); // trailing null
-		}
-		return str;
-	}
-
-	byte[] extractByteString() {
-		int len = extractInt();
-		byte[] b = new byte[0];
-
-		if (len > 0) {
-			b = extractByteArray(len); // the packed length DOES NOT include
-			// the null character
-			extractByte(); // trailing null
-		}
-
-		return b;
-	}
-
-	void setDataBuffer(ByteBuffer buf) {
-		this.dataBuffer = buf;
-	}
-
-	void setTrailer(byte[] buf) {
-		this.trailer = buf;
-	}
-
-	ByteBuffer getDataBuffer() {
-		return this.dataBuffer;
-	}
-
-	byte[] getTrailer() {
-		return this.trailer;
-	}
-	
-	void setByteSwap(boolean byteSwap) {
-		this.swap = byteSwap;
-	}
-
-	boolean getByteSwap() {
-		return this.swap;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/MessageDigest.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/MessageDigest.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/MessageDigest.java
deleted file mode 100644
index 4484076..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/MessageDigest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-//
-**********************************************************************/
-
-/**
-  * class MessageDigest - Computes the message authentication code using
-  *                      the SHA256 hash function
-  */
-
-package org.trafodion.jdbc.t4;
-
-public class MessageDigest
-{
-   private static class Holder
-   {
-      private static MessageDigest instance = new MessageDigest();
-   }
-
-   /**
-     *
-     * @return MessageDigest
-     */
-   public static MessageDigest getInstance()
-   {
-      return Holder.instance;
-   }
-
-   /**Digests message using HmacSHA256 algorithm.
-    * @param key - session key to use for create secret key used in HMAC digest
-    * @param data - The data used to create the digest
-    * @param md - returns the digested message
-    * @return the digested message's length or -1 in case of failure
-    * @throw SecurityException
-    */
-   public int digest(byte[] key, byte[] data, byte[] md) throws SecurityException
-   {
-      if (key == null)
-         throw new SecurityException(SecClientMsgKeys.INPUT_PARAMETER_IS_NULL,
-        		 new Object[]{"key"});
-      if (data == null)
-          throw new SecurityException(SecClientMsgKeys.INPUT_PARAMETER_IS_NULL,
-         		 new Object[]{"data"});
-      if (md == null)
-          throw new SecurityException(SecClientMsgKeys.INPUT_PARAMETER_IS_NULL,
-         		 new Object[]{"md"});
-      try {
-    	  javax.crypto.spec.SecretKeySpec keySpec =
-    		new javax.crypto.spec.SecretKeySpec(key, "HmacSHA256");
-    	  javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA256");
-    	  byte[] tmpMd;
-    	  synchronized (mac) {
-    		  mac.init(keySpec);
-
-    		  tmpMd = mac.doFinal(data);
-    	  }
-    	  System.arraycopy(tmpMd, 0, md, 0, tmpMd.length);
-
-         return tmpMd.length;
-      }catch (Exception ex) {
-          throw new SecurityException(SecClientMsgKeys.HMAC_FAILED, null);
-      }
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/NCSAddress.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/NCSAddress.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/NCSAddress.java
deleted file mode 100644
index a23c7e6..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/NCSAddress.java
+++ /dev/null
@@ -1,220 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-/**********************************************************
- * This class represents an address reference.
- *
- * @version 1.0
- **********************************************************/
-
-import java.sql.SQLException;
-import java.util.Locale;
-
-final class NCSAddress extends Address {
-
-	private static final String ODBCServerPrefix = "TCP:";
-	private static final String ODBCServerSuffix = ":ODBC";
-	private static final int minODBCServerAddrLen = ODBCServerPrefix.length() + 7 + ODBCServerSuffix.length();
-
-	static final int OS_type = 2; // TCP:\<Machine Name>.<Process
-
-	// Name>/<port>:ODBC
-
-	/**
-	 * The constructor.
-	 * 
-	 * @param addr
-	 *            The addr has the format:
-	 * 
-	 * ODBC server connect format returned by the ODBC Association Server.
-	 * 
-	 * TCP:\<{IP Address|Machine Name}>.<Process Name>/<port>:ODBC
-	 * 
-	 * 
-	 */
-	NCSAddress(T4Properties t4props, Locale locale, String addr) throws SQLException {
-		super(t4props, locale, addr);
-		int index0;
-		int index1;
-		int index2;
-		int index3;
-
-		m_locale = locale;
-
-		if (addr == null) {
-			SQLException se = HPT4Messages.createSQLException(m_t4props, m_locale, "address_null_error", null);
-			throw se;
-		}
-
-		if (acceptsURL(addr) == true) {
-			//
-			// We are dealing with an address of the form:
-			//
-			// TCP:\<{IP Address|Machine Name}>.<Process
-			// Name>/<port>:ODBC
-			//
-			m_type = OS_type;
-			if (addr.endsWith(ODBCServerSuffix) == false) {
-				SQLException se = HPT4Messages.createSQLException(m_t4props, m_locale, "address_parsing_error", addr);
-				SQLException se2 = HPT4Messages.createSQLException(m_t4props, m_locale, "odbc_server_suffix_error",
-						ODBCServerSuffix);
-
-				se.setNextException(se2);
-				throw se;
-			}
-			if (addr.length() < minODBCServerAddrLen) {
-				SQLException se = HPT4Messages.createSQLException(m_t4props, m_locale, "address_parsing_error", addr);
-				SQLException se2 = HPT4Messages.createSQLException(m_t4props, m_locale, "min_address_length_error",
-						null);
-
-				se.setNextException(se2);
-				throw se;
-			}
-
-			addr = addr.substring(ODBCServerPrefix.length());
-			addr = addr.substring(0, addr.length() - ODBCServerSuffix.length());
-
-			if (addr.indexOf(",") > 0)
-				interpretNEOAddress(t4props, locale, addr);
-			else
-				interpretAddress(t4props, locale, addr);
-
-			if ((m_machineName == null && m_ipAddress == null) || m_processName == null || m_portNumber == null) {
-				SQLException se = HPT4Messages.createSQLException(m_t4props, m_locale, "address_parsing_error", addr);
-				SQLException se2 = HPT4Messages.createSQLException(m_t4props, m_locale, "address_format_1_error", null);
-
-				se.setNextException(se2);
-				throw se;
-			}
-		}
-	} // end Address
-
-	// ----------------------------------------------------------
-	void interpretAddress(T4Properties t4props, Locale locale, String addr) throws SQLException {
-		//
-		// We are now expecting addr = "\<machine name>.<process name>/<port
-		// number>"
-		//
-
-		int index1 = addr.indexOf("\\");
-		int index3 = addr.indexOf("/");
-
-		//
-		// Find <{IP Address|Machine Name}>
-		//
-		int index2 = addr.lastIndexOf(".", index3);
-
-		if ((-1 < index1 && index1 < index2 && index2 < index3 && index3 < addr.length()) == false) {
-			SQLException se = HPT4Messages.createSQLException(m_t4props, m_locale, "address_parsing_error", addr);
-			SQLException se2 = HPT4Messages.createSQLException(m_t4props, m_locale, "address_format_1_error", null);
-
-			se.setNextException(se2);
-			throw se;
-		}
-
-		String temp4 = addr.substring((index1 + 1), index2);
-
-		if (Character.isDigit(temp4.charAt(0)) || temp4.substring(0, 1).equals("[")) {
-			//
-			// If first letter is a digit or "[" (i.e. IPv6), I'll assume it is
-			// an IP address
-			//
-			m_ipAddress = temp4;
-		} else {
-			m_machineName = temp4;
-		}
-
-		m_processName = addr.substring((index2 + 1), index3);
-		m_portNumber = new Integer(addr.substring((index3 + 1), addr.length()));
-	}
-
-	void interpretNEOAddress(T4Properties t4props, Locale locale, String addr) throws SQLException {
-		//
-		// We are now expecting addr = "\<machine name>.<process name>,<{IP
-		// Address|Machine Name}>/<port number>"
-		//
-		//int index1 = addr.indexOf("\\");
-		int index3 = addr.indexOf("/");
-		int index4 = addr.indexOf(",");
-		//
-		// Find <{IP Address|Machine Name}>
-		//
-		int index2 = addr.indexOf(".", 0);
-
-		if ((/*-1 < index1 && index1 < index2 &&*/ index2 < index4 && index4 < index3 && index3 < addr.length()) == false) {
-			SQLException se = HPT4Messages.createSQLException(m_t4props, m_locale, "address_parsing_error", addr);
-			SQLException se2 = HPT4Messages.createSQLException(m_t4props, m_locale, "address_format_1_error", null);
-
-			se.setNextException(se2);
-			throw se;
-		}
-
-		String temp4 = addr.substring((index4 + 1), index3);
-
-		if (Character.isDigit(temp4.charAt(0)) || temp4.substring(0, 1).equals("[")) {
-			//
-			// If first letter is a digit or "[" (i.e. IPv6), I'll assume it is
-			// an IP address
-			//
-			m_ipAddress = temp4;
-		} else {
-			m_machineName = temp4;
-		}
-
-		m_processName = addr.substring((index2 + 1), index4);
-		m_portNumber = new Integer(addr.substring((index3 + 1), addr.length()));
-	}
-
-	// ----------------------------------------------------------
-	String recreateAddress() {
-		String addr = ODBCServerPrefix + "\\";
-
-		if (m_machineName != null) {
-			addr = addr + m_machineName;
-		}
-		addr = addr + ".";
-
-		if (m_processName != null) {
-			addr = addr + m_processName;
-
-		}
-		addr = addr + "/";
-
-		if (m_portNumber != null) {
-			addr = addr + m_portNumber;
-
-		}
-		addr = addr + ODBCServerSuffix;
-
-		return addr;
-	} // end recreateAddress
-
-	static boolean acceptsURL(String url) throws SQLException {
-		try {
-			return (url.toUpperCase().startsWith(ODBCServerPrefix));
-		} catch (Exception ex) {
-			throw new SQLException(ex.toString());
-		}
-	}
-
-} // end class Address

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/OUT_CONNECTION_CONTEXT_def.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/OUT_CONNECTION_CONTEXT_def.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/OUT_CONNECTION_CONTEXT_def.java
deleted file mode 100644
index b7b07dc..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/OUT_CONNECTION_CONTEXT_def.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-import java.sql.SQLException;
-
-class OUT_CONNECTION_CONTEXT_def {
-	static final long OUTCONTEXT_OPT1_ENFORCE_ISO88591 = 1; // (2^0)
-	static final long OUTCONTEXT_OPT1_IGNORE_SQLCANCEL = 1073741824; // (2^30)
-	static final long OUTCONTEXT_OPT1_EXTRA_OPTIONS = 2147483648L; // (2^31)
-	static final long OUTCONTEXT_OPT1_DOWNLOAD_CERTIFICATE = 536870912; //(2^29)
-
-	VERSION_LIST_def versionList;
-
-	short nodeId;
-	int processId;
-
-	String computerName;
-	String catalog;
-	String schema;
-
-	int optionFlags1;
-	int optionFlags2;
-
-	String _roleName;
-	boolean _enforceISO;
-	boolean _ignoreCancel;
-
-	byte [] certificate;
-
-	void extractFromByteArray(LogicalByteArray buf, InterfaceConnection ic) throws SQLException,
-			UnsupportedCharsetException, CharacterCodingException {
-		versionList = new VERSION_LIST_def();
-		versionList.extractFromByteArray(buf);
-
-		nodeId = buf.extractShort();
-		processId = buf.extractInt();
-		computerName = ic.decodeBytes(buf.extractString(), 1);
-
-		catalog = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
-		schema = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
-		optionFlags1 = buf.extractInt();
-		optionFlags2 = buf.extractInt();
-
-		this._enforceISO = (optionFlags1 & OUTCONTEXT_OPT1_ENFORCE_ISO88591) > 0;
-		this._ignoreCancel = (optionFlags1 & OUTCONTEXT_OPT1_IGNORE_SQLCANCEL) > 0;
-		if((optionFlags1 & OUTCONTEXT_OPT1_DOWNLOAD_CERTIFICATE) > 0) {
-			certificate = buf.extractByteArray();
-		}
-		else if ((optionFlags1 & OUTCONTEXT_OPT1_EXTRA_OPTIONS) > 0) {
-			try {
-				this.decodeExtraOptions(ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8));
-			} catch (Exception e) {
-				ic.t4props_.logger.warning("An error occurred parsing OutConnectionContext: " + e.getMessage());
-			}
-		}
-	}
-
-	public void decodeExtraOptions(String options) {
-		String[] opts = options.split(";");
-		String token;
-		String value;
-		int index;
-
-		for (int i = 0; i < opts.length; i++) {
-			index = opts[i].indexOf('=');
-			token = opts[i].substring(0, index).toUpperCase();
-			value = opts[i].substring(index + 1);
-
-			if (token.equals("RN")) {
-				this._roleName = value;
-			}
-		}
-	}
-}