public class TdsCore
extends java.lang.Object
Implementation notes:
| Modifier and Type | Class and Description | 
|---|---|
| private static class  | TdsCore.TableMetaDataInner static class used to hold table meta data. | 
| private static class  | TdsCore.TdsTokenInner static class used to hold information about TDS tokens read. | 
| Modifier and Type | Field and Description | 
|---|---|
| private boolean | _ErrorReceivedflag set to  truewhenever a TDS_ERROR token is received | 
| private org.ietf.jgss.GSSContext | _gssContext | 
| private static byte | ALTMETADATA_TOKENTDS 7.0 Computed Result set column meta data token. | 
| private static int | ASYNC_CANCELCancel has been generated by  Statement.cancel(). | 
| static byte | CANCEL_PKTTDS Cancel packet. | 
| private int[] | cancelMonitorSynchronization monitor for  cancelPending. | 
| private boolean | cancelPendingIndicates pending cancel that needs to be cleared. | 
| private ColInfo[] | columnsThe array of column meta data objects for this result set. | 
| private ColInfo[] | computedColumnsThe array of column meta data objects for the computed columns of this result set. | 
| private java.lang.Object[] | computedRowDataThe array of computed column data objects in the current row. | 
| private JtdsConnection | connectionThe Connection object that created this object. | 
| private Semaphore | connectionLockMutual exclusion lock on connection. | 
| private TdsCore.TdsToken | currentTokenThe descriptor object for the current TDS token. | 
| static int | DEFAULT_MIN_PKT_SIZE_TDS70Default minimum network packet size for TDS 7.0 and newer. | 
| (package private) static byte | DONE_CANCELDone: Cancel acknowledgment. | 
| private static byte | DONE_END_OF_RESPONSEDone: Response terminator (if more than one request packet is sent, each
 response is terminated by a DONE packet with this flag set). | 
| private static byte | DONE_ERRORDone: command caused an error. | 
| private static byte | DONE_MORE_RESULTSDone: more results are expected. | 
| private static byte | DONE_ROW_COUNTDone: There is a valid row count. | 
| private static ParamInfo[] | EMPTY_PARAMETER_INFOUsed to optimize the  getParameters()call | 
| private boolean | endOfResponseTrue if the server response is fully read. | 
| private boolean | endOfResultsTrue if the current result set is at end of file. | 
| static int | EXECUTE_SQLPrepare SQL using sp_executesql | 
| private boolean | fatalErrorIndicates that a fatal error has occurred and the connection will close. | 
| private static java.lang.String | hostNameName of the client host (it can take quite a while to find it out if DNS is configured incorrectly). | 
| private ResponseStream | inThe input server response stream. | 
| private boolean | inBatchIndicates processing a batch. | 
| private boolean | isClosedIndicates that this object is closed. | 
| static byte | LOGIN_PKTTDS 4.2 or 5.0 Login packet. | 
| static int | MAX_PKT_SIZEMaximum network packet size. | 
| private SQLDiagnostic | messagesThe head of the diagnostic messages chain. | 
| static int | MIN_PKT_SIZEMinimum network packet size. | 
| static byte | MSDTC_PKTTDS MSDTC packet. | 
| static byte | MSLOGIN_PKTTDS 7.0 Login packet. | 
| private int | nextParamThe index of the next output parameter to populate. | 
| (package private) byte[] | nonceThe nonce from an NTLM challenge packet. | 
| static byte | NTLMAUTH_PKTTDS 7.0 NTLM Authentication packet. | 
| private boolean | ntlmAuthSSOFlag that indicates if logon() should try to use Windows Single Sign On using SSPI
 or Kerberos SSO via Java native GSSAPI. | 
| (package private) byte[] | ntlmMessageNTLM authentication message. | 
| (package private) byte[] | ntlmTargettarget info for NTLM message | 
| private RequestStream | outThe output server request stream. | 
| private ParamInfo[] | parametersThe array of parameter meta data objects for the current procedure call. | 
| static int | PKT_HDR_LENThe size of the packet header. | 
| static byte | PRELOGIN_PKTSQL 2000 prelogin negotiation packet. | 
| static int | PREPAREPrepare SQL using sp_prepare and sp_execute | 
| static byte | QUERY_PKTTDS 4.2 or 7.0 Query packet. | 
| static byte | REPLY_PKTTDS Reply packet. | 
| private ParamInfo | returnParamThe return parameter meta data object for the current procedure call. | 
| private java.lang.Integer | returnStatusThe stored procedure return status. | 
| private java.lang.Object[] | rowDataThe array of column data objects in the current row. | 
| static byte | RPC_PKTTDS Remote Procedure Call. | 
| private int | serverTypeThe make of SQL Server (Sybase/Microsoft). | 
| private SharedSocket | socketThe Shared network socket object. | 
| static int | SSL_CLIENT_FORCE_ENCRYPTSSL Mode - Client requested force encryption. | 
| static int | SSL_ENCRYPT_LOGINSSL Mode - Login packet must be encrypted. | 
| static int | SSL_NO_ENCRYPTSSL Mode - No server certificate installed. | 
| static int | SSL_SERVER_FORCE_ENCRYPTSSL Mode - Server requested force encryption. | 
| private int | sslModeIndicates type of SSL connection. | 
| private static SSPIJNIClient | sspiJNIClientA reference to ntlm.SSPIJNIClient. | 
| (package private) static int | SYB_BIGINTSybase 15+ bigint. | 
| (package private) static int | SYB_BITNULLSybase nullable bit type. | 
| (package private) static int | SYB_DATETIMESybase date and time data types. | 
| (package private) static int | SYB_EXTCOLINFOSybase extended column meta data. | 
| (package private) static int | SYB_LONGDATASybase char and binary > 255. | 
| (package private) static int | SYB_UNICODESybase univarchar etc. | 
| (package private) static int | SYB_UNITEXTSybase 15+ unitext. | 
| static byte | SYBQUERY_PKTTDS 5.0 Query packet. | 
| private TdsCore.TableMetaData[] | tablesThe array of table names associated with this result. | 
| private static byte | TDS_ALTROWTDS Computed result set data row token. | 
| private static byte | TDS_AUTH_TOKENTDS 7.0 NTLM authentication challenge token. | 
| private static byte | TDS_CAP_TOKENTDS 5.0 capabilities token. | 
| private static byte | TDS_CLOSE_TOKENTDS 5.0 Close token. | 
| private static byte | TDS_COLFMT_TOKENTDS 4.2 Column meta data token. | 
| private static byte | TDS_COLINFO_TOKENTDS Cursor results column infomation token. | 
| private static byte | TDS_COLNAME_TOKENTDS 4.2 Column names token. | 
| private static byte | TDS_COMP_NAMES_TOKENTDS Computed result set names token. | 
| private static byte | TDS_COMP_RESULT_TOKENTDS Computed result set token. | 
| private static byte | TDS_CONTROL_TOKENTDS control token. | 
| private static byte | TDS_DBRPC_TOKENTDS 5.0 RPC token. | 
| private static byte | TDS_DONE_TOKENTDS done token. | 
| private static byte | TDS_DONEINPROC_TOKENTDS done in procedure token. | 
| private static byte | TDS_DONEPROC_TOKENTDS done procedure token. | 
| private static byte | TDS_ENV_CHARSETEnvironment change: charset changed. | 
| private static byte | TDS_ENV_DATABASEEnvironment change: database changed. | 
| private static byte | TDS_ENV_LANGEnvironment change: language changed. | 
| private static byte | TDS_ENV_LCIDEnvironment change: locale changed. | 
| private static byte | TDS_ENV_PACKSIZEEnvironment change: network packet size changed. | 
| private static byte | TDS_ENV_SQLCOLLATIONEnvironment change: TDS 8 collation changed. | 
| private static byte | TDS_ENVCHANGE_TOKENTDS environment change token. | 
| private static byte | TDS_ERROR_TOKENTDS error result token. | 
| private static byte | TDS_INFO_TOKENTDS Information message token. | 
| private static byte | TDS_LANG_TOKENTDS 5.0 Language token. | 
| private static byte | TDS_LOGINACK_TOKENTDS Login acknowledgement token. | 
| private static byte | TDS_MSG50_TOKENTDS 5.0 message token. | 
| private static byte | TDS_OFFSETS_TOKENTDS DBLIB Offsets token. | 
| private static byte | TDS_ORDER_TOKENTDS Order by columns token. | 
| private static byte | TDS_PARAM_TOKENTDS Output parameter value token. | 
| private static byte | TDS_PROCIDTDS Procedure ID token. | 
| private static byte | TDS_RESULT_TOKENTDS 5.0 Result set column meta data token. | 
| private static byte | TDS_RETURNSTATUS_TOKENTDS Procedure call return status token. | 
| private static byte | TDS_ROW_TOKENTDS Result set data row token. | 
| private static byte | TDS_TABNAME_TOKENTDS Table name token. | 
| private static byte | TDS5_DYNAMIC_TOKENTDS 5.0 Dynamic SQL token. | 
| private static byte | TDS5_PARAMFMT_TOKENTDS 5.0 parameter descriptor token. | 
| private static byte | TDS5_PARAMFMT2_TOKENTDS 5.0 Parameter format token. | 
| private static byte | TDS5_PARAMS_TOKENTDS 5.0 parameter value token. | 
| private static byte | TDS5_WIDE_RESULTTSD 5.0 Wide result set token. | 
| private static byte | TDS7_RESULT_TOKENTDS 7.0 Result set column meta data token. | 
| private static java.util.HashMap | tds8SpNamesMap of system stored procedures that have shortcuts in TDS8. | 
| private int | tdsVersionThe TDS version being supported by this connection. | 
| static int | TEMPORARY_STORED_PROCEDURESPrepare SQL using temporary stored procedures | 
| private static int | TIMEOUT_CANCELCancel has been generated by a query timeout. | 
| static int | UNPREPAREDDo not prepare SQL | 
| Constructor and Description | 
|---|
| TdsCore(JtdsConnection connection,
       SQLDiagnostic messages)Construct a TdsCore object. | 
| Modifier and Type | Method and Description | 
|---|---|
| (package private) void | cancel(boolean timeout)Send (only) one cancel packet to the server. | 
| private void | checkOpen()Check that the connection is still open. | 
| void | cleanUp()Releases parameter and result set data and metadata to free up memory. | 
| (package private) void | clearResponseQueue()Empty the server response queue. | 
| (package private) void | close()Close the  TdsCoreconnection object and associated streams. | 
| (package private) void | closeConnection()Inform the server that this connection is closing. | 
| (package private) void | consumeOneResponse()Consume packets from the server response queue up to (and including) the
 first response terminator. | 
| private byte[] | createGssToken()Initializes the GSS context and creates the initial token. | 
| (package private) byte[] | enlistConnection(int type,
                byte[] oleTranID)Enlist the current connection in a distributed transaction or request the location of the
 MSDTC instance controlling the server we are connected to. | 
| (package private) void | executeSQL(java.lang.String sql,
          java.lang.String procName,
          ParamInfo[] parameters,
          boolean noMetaData,
          int timeOut,
          int maxRows,
          int maxFieldSize,
          boolean sendNow)Send an SQL statement with optional parameters to the server. | 
| private void | executeSQL42(java.lang.String sql,
            java.lang.String procName,
            ParamInfo[] parameters,
            boolean noMetaData,
            boolean sendNow)Execute SQL using TDS 4.2 protocol. | 
| private void | executeSQL50(java.lang.String sql,
            java.lang.String procName,
            ParamInfo[] parameters)Execute SQL using TDS 5.0 protocol. | 
| private void | executeSQL70(java.lang.String sql,
            java.lang.String procName,
            ParamInfo[] parameters,
            boolean noMetaData,
            boolean sendNow)Execute SQL using TDS 7.0 protocol. | 
| (package private) java.sql.SQLException | getBatchCounts(java.util.ArrayList counts,
              java.sql.SQLException sqlEx)Obtain the counts from a batch of SQL updates. | 
| (package private) ColInfo[] | getColumns()Retrieve the current result set column descriptors. | 
| (package private) ColInfo[] | getComputedColumns() Retrieve the current computed result set column descriptors, if any. | 
| (package private) java.lang.Object[] | getComputedRowData() Retrieve and clear the current computed result set data items,
 if any. | 
| private static java.lang.String | getHostName()Tries to figure out what client name we should identify ourselves as. | 
| private static int | getIntFromBuffer(byte[] buf,
                int offset) | 
| private static byte[] | getMACAddress(java.lang.String macString)Converts a user supplied MAC address into a byte array. | 
| SQLDiagnostic | getMessages()Returns the diagnostic chain for this instance. | 
| (package private) boolean | getMoreResults()Get the next result set or update count from the TDS stream. | 
| (package private) boolean | getNextRow()Retrieve the next data row from the result set. | 
| (package private) ParamInfo[] | getParameters()Retrieve the parameter meta data from a Sybase prepare. | 
| (package private) java.lang.Integer | getReturnStatus()Retrieve the return status for the current stored procedure. | 
| (package private) java.lang.Object[] | getRowData()Retrieve the current result set data items. | 
| private static int | getShortFromBuffer(byte[] buf,
                  int offset) | 
| (package private) int | getTdsVersion()Retrieve the TDS protocol version. | 
| (package private) int | getUpdateCount()Retrieve the update count from the current TDS token. | 
| (package private) boolean | isDataInResultSet() Retrieve the status of result set. | 
| (package private) boolean | isEndOfResponse()Retrieve the status of the response stream. | 
| static boolean | isPreparedProcedureName(java.lang.String procName)Returns  trueif the specifiedprocNameis a sp_prepare or sp_prepexec handle; returnsfalseotherwise. | 
| (package private) boolean | isResultSet()Retrieve the status of the next result item. | 
| (package private) boolean | isRowData()Retrieve the status of the next result item. | 
| (package private) boolean | isUpdateCount()Retrieve the status of the next result item. | 
| (package private) static boolean | isWindowsOS() Checks whether the  os.namesystem property contains
 "windows". | 
| (package private) void | login(java.lang.String serverName,
     java.lang.String database,
     java.lang.String user,
     java.lang.String password,
     java.lang.String domain,
     java.lang.String charset,
     java.lang.String appName,
     java.lang.String progName,
     java.lang.String wsid,
     java.lang.String language,
     java.lang.String macAddress,
     int packetSize)Login to the SQL Server. | 
| (package private) java.lang.String | microsoftPrepare(java.lang.String sql,
                ParamInfo[] params,
                boolean needCursor,
                int resultSetType,
                int resultSetConcurrency)Prepares the SQL for use with Microsoft server. | 
| (package private) void | negotiateSSL(java.lang.String instance,
            java.lang.String ssl)Negotiate SSL settings with SQL 2000+ server. | 
| private void | nextToken()Read the next TDS token from the response stream. | 
| private void | putLoginString(java.lang.String txt,
              int len)Write a TDS login packet string. | 
| private int | readPreLoginPacket()Process the pre login acknowledgment from the server. | 
| private void | send42LoginPkt(java.lang.String serverName,
              java.lang.String user,
              java.lang.String password,
              java.lang.String charset,
              java.lang.String appName,
              java.lang.String progName,
              java.lang.String wsid,
              java.lang.String language,
              int packetSize)TDS 4.2 Login Packet. | 
| private void | send50LoginPkt(java.lang.String serverName,
              java.lang.String user,
              java.lang.String password,
              java.lang.String charset,
              java.lang.String appName,
              java.lang.String progName,
              java.lang.String wsid,
              java.lang.String language,
              int packetSize)TDS 5.0 Login Packet. | 
| private void | sendGssToken()Send the next GSS authentication token. | 
| private void | sendMSLoginPkt(java.lang.String serverName,
              java.lang.String database,
              java.lang.String user,
              java.lang.String password,
              java.lang.String domain,
              java.lang.String appName,
              java.lang.String progName,
              java.lang.String wsid,
              java.lang.String language,
              java.lang.String macAddress,
              int netPacketSize)Send a TDS 7 login packet. | 
| private void | sendNtlmChallengeResponse(java.lang.String user,
                         java.lang.String password,
                         java.lang.String domain)Send the response to the NTLM authentication challenge. | 
| private void | sendPreLoginPacket(java.lang.String instance,
                  boolean forceEncryption)Send the SQL Server 2000 pre login packet. | 
| (package private) void | setColumns(ColInfo[] columns)Sets the column meta data. | 
| private void | setRowCountAndTextSize(int rowCount,
                      int textSize)Sets the server row count (to limit the number of rows in a result set)
 and text size (to limit the size of returned TEXT/NTEXT fields). | 
| (package private) void | startBatch()Notifies the  TdsCorethat a batch is starting. | 
| (package private) void | submitSQL(java.lang.String sql)Submit a simple SQL statement to the server and process all output. | 
| (package private) java.lang.String | sybasePrepare(java.lang.String sql,
             ParamInfo[] params)Creates a light weight stored procedure on a Sybase server. | 
| (package private) void | sybaseUnPrepare(java.lang.String procName)Drops a Sybase temporary stored procedure. | 
| private void | tds4ColFormatToken()Process a TDS 4.2 column format token. | 
| private void | tds4ColNamesToken()Process a TDS 4.2 column names token. | 
| private void | tds5DynamicToken()Process TDS5 dynamic SQL aknowledgements. | 
| private void | tds5ErrorToken()Process a TDS 5 error or informational message. | 
| private void | tds5ParamFmt2Token()Process TDS 5 Sybase 12+ Dynamic results parameter descriptor. | 
| private void | tds5ParamFmtToken()Process TDS 5 Dynamic results parameter descriptors. | 
| private void | tds5ParamsToken()Process TDS 5.0 Params Token. | 
| private void | tds5ResultToken()Process a TDS 5.0 result set packet. | 
| private void | tds5WideResultToken()Process Sybase 12+ wide result token which provides enhanced
 column meta data. | 
| private static java.lang.String | tds7CryptPass(java.lang.String pw)A very poor man's "encryption". | 
| private void | tds7ResultToken()Process a TDS 7.0 result set token. | 
| private void | tdsCapabilityToken()Processes a TDS 5.0 capability token. | 
| private void | tdsColumnInfoToken()Process a column infomation token. | 
| private void | tdsComputedResultToken() Process meta data for the computed result set complementing the
 current result set. | 
| private void | tdsComputedRowToken() Process computed row data. | 
| private void | tdsControlToken()Process a control token (function unknown). | 
| private void | tdsDoneToken()Process a DONE, DONEINPROC or DONEPROC token. | 
| private void | tdsEnvChangeToken()Process an environment change packet. | 
| private void | tdsErrorToken()Process a TD4/TDS7 error or informational message. | 
| private void | tdsGssToken()Receive a GSS token. | 
| private void | tdsInvalidToken()Report unsupported TDS token in input stream. | 
| private void | tdsLoginAckToken()Process a login acknowledgement packet. | 
| private void | tdsNtlmAuthToken()Process a NTLM Authentication challenge. | 
| private void | tdsOffsetsToken()Process offsets token. | 
| private void | tdsOrderByToken()Process an order by token. | 
| private void | tdsOutputParamToken()Process output parameters. | 
| private void | tdsProcIdToken()Process procedure ID token. | 
| private void | tdsReturnStatusToken()Process stored procedure return status token. | 
| private void | tdsRowToken()Process a row data token. | 
| private void | tdsTableNameToken()Process a table name token. | 
| private void | wait(int timeOut)Waits for the first byte of the server response. | 
public static final int MIN_PKT_SIZE
public static final int DEFAULT_MIN_PKT_SIZE_TDS70
public static final int MAX_PKT_SIZE
public static final int PKT_HDR_LEN
public static final byte QUERY_PKT
public static final byte LOGIN_PKT
public static final byte RPC_PKT
public static final byte REPLY_PKT
public static final byte CANCEL_PKT
public static final byte MSDTC_PKT
public static final byte SYBQUERY_PKT
public static final byte MSLOGIN_PKT
public static final byte NTLMAUTH_PKT
public static final byte PRELOGIN_PKT
public static final int SSL_ENCRYPT_LOGIN
public static final int SSL_CLIENT_FORCE_ENCRYPT
public static final int SSL_NO_ENCRYPT
public static final int SSL_SERVER_FORCE_ENCRYPT
private static final byte TDS5_PARAMFMT2_TOKEN
private static final byte TDS_LANG_TOKEN
private static final byte TDS5_WIDE_RESULT
private static final byte TDS_CLOSE_TOKEN
private static final byte TDS_OFFSETS_TOKEN
private static final byte TDS_RETURNSTATUS_TOKEN
private static final byte TDS_PROCID
private static final byte TDS7_RESULT_TOKEN
private static final byte ALTMETADATA_TOKEN
private static final byte TDS_COLNAME_TOKEN
private static final byte TDS_COLFMT_TOKEN
private static final byte TDS_TABNAME_TOKEN
private static final byte TDS_COLINFO_TOKEN
private static final byte TDS_COMP_NAMES_TOKEN
private static final byte TDS_COMP_RESULT_TOKEN
private static final byte TDS_ORDER_TOKEN
private static final byte TDS_ERROR_TOKEN
private static final byte TDS_INFO_TOKEN
private static final byte TDS_PARAM_TOKEN
private static final byte TDS_LOGINACK_TOKEN
private static final byte TDS_CONTROL_TOKEN
private static final byte TDS_ROW_TOKEN
private static final byte TDS_ALTROW
private static final byte TDS5_PARAMS_TOKEN
private static final byte TDS_CAP_TOKEN
private static final byte TDS_ENVCHANGE_TOKEN
private static final byte TDS_MSG50_TOKEN
private static final byte TDS_DBRPC_TOKEN
private static final byte TDS5_DYNAMIC_TOKEN
private static final byte TDS5_PARAMFMT_TOKEN
private static final byte TDS_AUTH_TOKEN
private static final byte TDS_RESULT_TOKEN
private static final byte TDS_DONE_TOKEN
private static final byte TDS_DONEPROC_TOKEN
private static final byte TDS_DONEINPROC_TOKEN
private static final byte TDS_ENV_DATABASE
private static final byte TDS_ENV_LANG
private static final byte TDS_ENV_CHARSET
private static final byte TDS_ENV_PACKSIZE
private static final byte TDS_ENV_LCID
private static final byte TDS_ENV_SQLCOLLATION
private static final ParamInfo[] EMPTY_PARAMETER_INFO
getParameters() callprivate static final byte DONE_MORE_RESULTS
private static final byte DONE_ERROR
private static final byte DONE_ROW_COUNT
static final byte DONE_CANCEL
private static final byte DONE_END_OF_RESPONSE
public static final int UNPREPARED
public static final int TEMPORARY_STORED_PROCEDURES
public static final int EXECUTE_SQL
public static final int PREPARE
static final int SYB_LONGDATA
static final int SYB_DATETIME
static final int SYB_BITNULL
static final int SYB_EXTCOLINFO
static final int SYB_UNICODE
static final int SYB_UNITEXT
static final int SYB_BIGINT
private static final int ASYNC_CANCEL
Statement.cancel().private static final int TIMEOUT_CANCEL
private static java.util.HashMap tds8SpNames
private static java.lang.String hostName
private static SSPIJNIClient sspiJNIClient
private final JtdsConnection connection
private int tdsVersion
private final int serverType
private final SharedSocket socket
private final RequestStream out
private final ResponseStream in
private boolean endOfResponse
private boolean endOfResults
private ColInfo[] columns
private ColInfo[] computedColumns
private java.lang.Object[] rowData
private java.lang.Object[] computedRowData
private TdsCore.TableMetaData[] tables
private final TdsCore.TdsToken currentToken
private java.lang.Integer returnStatus
private ParamInfo returnParam
private ParamInfo[] parameters
private int nextParam
private final SQLDiagnostic messages
private boolean isClosed
private boolean ntlmAuthSSO
private boolean fatalError
private Semaphore connectionLock
private boolean inBatch
private int sslMode
private boolean cancelPending
private final int[] cancelMonitor
cancelPending.private boolean _ErrorReceived
true whenever a TDS_ERROR token is receivedbyte[] nonce
byte[] ntlmMessage
byte[] ntlmTarget
private org.ietf.jgss.GSSContext _gssContext
TdsCore(JtdsConnection connection, SQLDiagnostic messages)
connection - The connection which owns this object.messages - The SQLDiagnostic messages chain.private void checkOpen()
                throws java.sql.SQLException
java.sql.SQLException - if the connection is closedint getTdsVersion()
int.ColInfo[] getColumns()
ColInfo[].void setColumns(ColInfo[] columns)
columns - the column descriptor arrayParamInfo[] getParameters()
ParamInfo[].java.lang.Object[] getRowData()
Object arrayvoid negotiateSSL(java.lang.String instance,
                java.lang.String ssl)
            throws java.io.IOException,
                   java.sql.SQLException
instance - The server instance name.ssl - The SSL URL property value.java.io.IOExceptionjava.sql.SQLExceptionvoid login(java.lang.String serverName,
         java.lang.String database,
         java.lang.String user,
         java.lang.String password,
         java.lang.String domain,
         java.lang.String charset,
         java.lang.String appName,
         java.lang.String progName,
         java.lang.String wsid,
         java.lang.String language,
         java.lang.String macAddress,
         int packetSize)
     throws java.sql.SQLException
serverName - server host namedatabase - required databaseuser - user namepassword - user passworddomain - Windows NT domain (or null)charset - required server character setappName - application nameprogName - library namewsid - workstation IDlanguage - language to use for server messagesmacAddress - client network MAC addresspacketSize - required network packet sizejava.sql.SQLException - if an error occursboolean getMoreResults()
                 throws java.sql.SQLException
true if the next item is a result set.java.sql.SQLException - if an I/O or protocol error occurs; server errors
                      are queued up and not thrownboolean isResultSet()
boolean true if the next item is a result set.boolean isRowData()
boolean true if the next item is row data.boolean isUpdateCount()
boolean true if the next item is an update count.int getUpdateCount()
int.boolean isEndOfResponse()
boolean true if the response has been entirely consumedvoid clearResponseQueue()
                  throws java.sql.SQLException
java.sql.SQLException - if an error occursvoid consumeOneResponse()
                  throws java.sql.SQLException
java.sql.SQLException - if an I/O or protocol error occurs; server errors
                      are queued up and not thrownboolean getNextRow()
             throws java.sql.SQLException
false if at the end of results, true
         otherwisejava.sql.SQLException - if an I/O or protocol error occurs; server errors
                      are queued up and not thrownboolean isDataInResultSet()
                    throws java.sql.SQLException
Retrieve the status of result set.
 This does a quick read ahead and is needed to support method JtdsResultSet.isLast(). 
true if there is more data in the result setjava.sql.SQLExceptionjava.lang.Integer getReturnStatus()
Integer.void closeConnection()
Used by Sybase a no-op for Microsoft.
void close()
     throws java.sql.SQLException
TdsCore connection object and associated streams.java.sql.SQLExceptionvoid cancel(boolean timeout)
timeout - true if this is a query timeout cancelvoid submitSQL(java.lang.String sql)
         throws java.sql.SQLException
sql - the statement to executejava.sql.SQLException - if an error is returned by the servervoid startBatch()
TdsCore that a batch is starting. This is so
 that it knows to use sp_executesql for parameterized
 queries (because there's no way to prepare a statement in the middle of
 a batch).
 
 Sets the inBatch flag.
void executeSQL(java.lang.String sql,
              java.lang.String procName,
              ParamInfo[] parameters,
              boolean noMetaData,
              int timeOut,
              int maxRows,
              int maxFieldSize,
              boolean sendNow)
          throws java.sql.SQLException
sql - SQL statement to executeprocName - stored procedure to execute or nullparameters - parameters for call or nullnoMetaData - suppress meta data for cursor callstimeOut - optional query timeout or 0maxRows - the maximum number of data rows to return (-1 to
                     leave unaltered)maxFieldSize - the maximum number of bytes in a column to return
                     (-1 to leave unaltered)sendNow - whether to send the request now or notjava.sql.SQLException - if an error occursjava.lang.String microsoftPrepare(java.lang.String sql,
                                ParamInfo[] params,
                                boolean needCursor,
                                int resultSetType,
                                int resultSetConcurrency)
                            throws java.sql.SQLException
sql - the SQL statement to prepare.params - the actual parameter listneedCursor - true if a cursorprepare is requiredresultSetType - value of the resultSetType parameter when
                             the Statement was createdresultSetConcurrency - value of the resultSetConcurrency parameter
                             whenthe Statement was createdjava.sql.SQLExceptionjava.lang.String sybasePrepare(java.lang.String sql,
                             ParamInfo[] params)
                         throws java.sql.SQLException
sql - SQL statement to prepareparams - the actual parameter listjava.sql.SQLException - if an error occursvoid sybaseUnPrepare(java.lang.String procName)
               throws java.sql.SQLException
procName - the temporary procedure namejava.sql.SQLException - if an error occursbyte[] enlistConnection(int type,
                      byte[] oleTranID)
                  throws java.sql.SQLException
type - set to 0 to request TM address or 1 to enlist connectionoleTranID - the 40 OLE transaction IDbyte[] array containing the TM address datajava.sql.SQLExceptionjava.sql.SQLException getBatchCounts(java.util.ArrayList counts,
                                   java.sql.SQLException sqlEx)
                               throws java.sql.SQLException
SQLExceptions are chained
 because there could be several errors reported in a batch.counts - the ArrayList containing the update countssqlEx - any previous SQLException(s) encounteredSQLException or null if no
         error has yet occurredjava.sql.SQLException - if the connection is closedColInfo[] getComputedColumns()
Retrieve the current computed result set column descriptors, if any.
ColInfo array;
    or null if there are no computed columnsjava.lang.Object[] getComputedRowData()
Retrieve and clear the current computed result set data items, if any.
Object array; or
    null if there are no computed columns, computed data has not
    yet been received, or the data has already been cleared by a previous
    call to this methodprivate void putLoginString(java.lang.String txt,
                  int len)
                     throws java.io.IOException
java.io.IOExceptionprivate void sendPreLoginPacket(java.lang.String instance,
                      boolean forceEncryption)
                         throws java.io.IOException
Packet contains; netlib version, ssl mode, instance and process ID.
instance - forceEncryption - java.io.IOExceptionprivate int readPreLoginPacket()
                        throws java.io.IOException
Packet contains; server version no, SSL mode, instance name and process id.
Server returns the following values for SSL mode:
java.io.IOExceptionprivate void send42LoginPkt(java.lang.String serverName,
                  java.lang.String user,
                  java.lang.String password,
                  java.lang.String charset,
                  java.lang.String appName,
                  java.lang.String progName,
                  java.lang.String wsid,
                  java.lang.String language,
                  int packetSize)
                     throws java.io.IOException
serverName - server host nameuser - user namepassword - user passwordcharset - required server character setappName - application nameprogName - program namewsid - workstation IDlanguage - server language for messagespacketSize - required network packet sizejava.io.IOException - if an I/O error occursprivate void send50LoginPkt(java.lang.String serverName,
                  java.lang.String user,
                  java.lang.String password,
                  java.lang.String charset,
                  java.lang.String appName,
                  java.lang.String progName,
                  java.lang.String wsid,
                  java.lang.String language,
                  int packetSize)
                     throws java.io.IOException
serverName - server host nameuser - user namepassword - user passwordcharset - required server character setappName - application nameprogName - library namewsid - workstation IDlanguage - server language for messagespacketSize - required network packet sizejava.io.IOException - if an I/O error occursprivate void sendMSLoginPkt(java.lang.String serverName,
                  java.lang.String database,
                  java.lang.String user,
                  java.lang.String password,
                  java.lang.String domain,
                  java.lang.String appName,
                  java.lang.String progName,
                  java.lang.String wsid,
                  java.lang.String language,
                  java.lang.String macAddress,
                  int netPacketSize)
                     throws java.io.IOException,
                            java.sql.SQLException
 This method incorporates the Windows single sign on code contributed by
 Magendran Sathaiah. To invoke single sign on just leave the user name
 blank or null. NB. This can only work if the driver is being executed on
 a Windows PC and ntlmauth.dll is on the path.
serverName - server host namedatabase - required databaseuser - user namepassword - user passworddomain - Windows NT domain (or null)appName - application nameprogName - program namewsid - workstation IDlanguage - server language for messagesmacAddress - client network MAC addressnetPacketSize - TDS packet size to usejava.io.IOException - if an I/O error occursjava.sql.SQLExceptionprivate void tdsGssToken()
                  throws java.io.IOException
java.io.IOExceptionprivate void sendGssToken()
                   throws java.io.IOException
java.io.IOExceptionprivate void sendNtlmChallengeResponse(java.lang.String user,
                             java.lang.String password,
                             java.lang.String domain)
                                throws java.io.IOException
nonce - The secret to hash with password.user - The user name.password - The user password.domain - The Windows NT Dommain.java.io.IOExceptionprivate void nextToken()
                throws java.sql.SQLException
java.sql.SQLException - if an I/O or protocol error occursprivate void tdsInvalidToken()
                      throws java.io.IOException,
                             ProtocolException
java.io.IOExceptionProtocolExceptionprivate void tds5ParamFmt2Token()
                         throws java.io.IOException,
                                ProtocolException
When returning output parameters this token will be followed by a TDS5_PARAMS_TOKEN with the actual data.
java.io.IOExceptionProtocolExceptionprivate void tds5WideResultToken()
                          throws java.io.IOException,
                                 ProtocolException
java.io.IOExceptionProtocolExceptionprivate void tdsReturnStatusToken()
                           throws java.io.IOException,
                                  java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionprivate void tdsProcIdToken()
                     throws java.io.IOException
Used by DBLIB to obtain the object id of a stored procedure.
java.io.IOExceptionprivate void tdsOffsetsToken()
                      throws java.io.IOException
 Used by DBLIB to return the offset of various keywords in a statement.
 This saves the client from having to parse a SQL statement. Enabled with
 "set offsets from on".
java.io.IOExceptionprivate void tds7ResultToken()
                      throws java.io.IOException,
                             ProtocolException,
                             java.sql.SQLException
java.io.IOExceptionProtocolExceptionjava.sql.SQLExceptionprivate void tds4ColNamesToken()
                        throws java.io.IOException
Note: Will be followed by a COL_FMT token.
java.io.IOExceptionprivate void tds4ColFormatToken()
                         throws java.io.IOException,
                                ProtocolException
java.io.IOExceptionProtocolExceptionprivate void tdsTableNameToken()
                        throws java.io.IOException,
                               ProtocolException
Sent by select for browse or cursor functions.
java.io.IOExceptionProtocolExceptionprivate void tdsColumnInfoToken()
                         throws java.io.IOException,
                                ProtocolException
Sent by select for browse or cursor functions.
java.io.IOExceptionProtocolExceptionprivate void tdsOrderByToken()
                      throws java.io.IOException
Sent to describe columns in an order by clause.
java.io.IOExceptionprivate void tdsErrorToken()
                    throws java.io.IOException
java.io.IOExceptionprivate void tdsOutputParamToken()
                          throws java.io.IOException,
                                 ProtocolException,
                                 java.sql.SQLException
java.io.IOExceptionProtocolExceptionjava.sql.SQLExceptionprivate void tdsLoginAckToken()
                       throws java.io.IOException
java.io.IOExceptionprivate void tdsControlToken()
                      throws java.io.IOException
java.io.IOExceptionprivate void tdsRowToken()
                  throws java.io.IOException,
                         ProtocolException
java.io.IOExceptionProtocolExceptionprivate void tds5ParamsToken()
                      throws java.io.IOException,
                             ProtocolException,
                             java.sql.SQLException
The type of the preceding token is inspected to determine if this packet contains output parameter result data. A TDS5_PARAMFMT2_TOKEN is sent before this one in Sybase 12 to introduce output parameter results. A TDS5_PARAMFMT_TOKEN is sent before this one to introduce extended error information.
java.io.IOExceptionProtocolExceptionjava.sql.SQLExceptionprivate void tdsCapabilityToken()
                         throws java.io.IOException,
                                ProtocolException
Sent after login to describe the server's capabilities.
java.io.IOException - if an I/O error occursProtocolExceptionprivate void tdsEnvChangeToken()
                        throws java.io.IOException,
                               java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionprivate void tds5ErrorToken()
                     throws java.io.IOException
java.io.IOExceptionprivate void tds5DynamicToken()
                       throws java.io.IOException
java.io.IOExceptionprivate void tds5ParamFmtToken()
                        throws java.io.IOException,
                               ProtocolException
With Sybase 12+ this has been superseded by the TDS5_PARAMFMT2_TOKEN except when used to return extended error information.
java.io.IOExceptionProtocolExceptionprivate void tdsNtlmAuthToken()
                       throws java.io.IOException,
                              ProtocolException
java.io.IOExceptionProtocolExceptionprivate static int getIntFromBuffer(byte[] buf,
                   int offset)
private static int getShortFromBuffer(byte[] buf,
                     int offset)
private void tds5ResultToken()
                      throws java.io.IOException,
                             ProtocolException
java.io.IOExceptionProtocolExceptionprivate void tdsDoneToken()
                   throws java.io.IOException
java.io.IOExceptionprivate void executeSQL42(java.lang.String sql,
                java.lang.String procName,
                ParamInfo[] parameters,
                boolean noMetaData,
                boolean sendNow)
                   throws java.io.IOException,
                          java.sql.SQLException
sql - The SQL statement to execute.procName - Stored procedure to execute or null.parameters - Parameters for call or null.noMetaData - Suppress meta data for cursor calls.java.sql.SQLExceptionjava.io.IOExceptionprivate void executeSQL50(java.lang.String sql,
                java.lang.String procName,
                ParamInfo[] parameters)
                   throws java.io.IOException,
                          java.sql.SQLException
sql - The SQL statement to execute.procName - Stored procedure to execute or null.parameters - Parameters for call or null.java.sql.SQLExceptionjava.io.IOExceptionpublic static boolean isPreparedProcedureName(java.lang.String procName)
true if the specified procName
 is a sp_prepare or sp_prepexec handle; returns false
 otherwise.procName - Stored procedure to execute or null.true if the specified procName
   is a sp_prepare or sp_prepexec handle; false
   otherwise.private void executeSQL70(java.lang.String sql,
                java.lang.String procName,
                ParamInfo[] parameters,
                boolean noMetaData,
                boolean sendNow)
                   throws java.io.IOException,
                          java.sql.SQLException
sql - The SQL statement to execute.procName - Stored procedure to execute or null.parameters - Parameters for call or null.noMetaData - Suppress meta data for cursor calls.java.sql.SQLExceptionjava.io.IOExceptionprivate void setRowCountAndTextSize(int rowCount,
                          int textSize)
                             throws java.sql.SQLException
rowCount - the number of rows to return or 0 for no limit or -1 to
                 leave as istextSize - the maximum number of bytes in a TEXT column to return
                 or -1 to leave as isjava.sql.SQLException - if an error is returned by the serverprivate void wait(int timeOut)
           throws java.io.IOException,
                  java.sql.SQLException
timeOut - the timeout period in seconds or 0java.io.IOExceptionjava.sql.SQLExceptionpublic void cleanUp()
TdsCore is cached for reuse.public SQLDiagnostic getMessages()
private static byte[] getMACAddress(java.lang.String macString)
macString - the MAC address as a hex stringbyte[]private static java.lang.String getHostName()
private static java.lang.String tds7CryptPass(java.lang.String pw)
pw - password to encryptprivate void tdsComputedResultToken()
                             throws java.io.IOException,
                                    ProtocolException
Process meta data for the computed result set complementing the current result set.
java.io.IOExceptionProtocolExceptionprivate void tdsComputedRowToken()
                          throws java.io.IOException,
                                 ProtocolException,
                                 java.sql.SQLException
Process computed row data.
java.io.IOExceptionProtocolExceptionjava.sql.SQLExceptionstatic boolean isWindowsOS()
 Checks whether the os.name system property contains
 "windows". 
private byte[] createGssToken()
                       throws org.ietf.jgss.GSSException,
                              java.net.UnknownHostException
org.ietf.jgss.GSSExceptionjava.net.UnknownHostExceptionGenerated on June 8 2013