java.lang.Runnable
class DRDAConnThread
extends java.lang.Thread
Modifier and Type | Class | Description |
---|---|---|
private static class |
DRDAConnThread.PublicBufferOutputStream |
Modifier and Type | Field | Description |
---|---|---|
private static int[] |
ACCRDB_REQUIRED |
|
private AppRequester |
appRequester |
|
private static java.lang.String |
AUTHENTICATION_PROVIDER_BUILTIN_CLASS |
|
private static java.lang.String |
AUTHENTICATION_PROVIDER_NONE_CLASS |
|
private boolean |
close |
End this thread.
|
private static int |
COMMIT |
|
private int |
correlationID |
|
private int |
currentRequiredLength |
|
private Database |
database |
|
private java.sql.SQLException |
databaseAccessException |
|
private static DecryptionManager |
decryptionManager |
|
private boolean |
deferredReset |
Tells if the reset / connect request is a deferred request.
|
private byte |
diagnosticLevel |
|
private static DRDAProtocolExceptionInfo |
dummy |
|
private static byte[] |
eod00000 |
|
private static byte[] |
eod02000 |
|
private static byte[] |
errD5_D6 |
|
private java.util.Calendar |
gmtCalendar |
A cached
Calendar instance using the GMT time zone. |
private java.util.List<java.lang.Integer> |
knownManagers |
|
private static java.lang.String |
leftBrace |
|
private boolean |
logConnections |
Whether or not to log connections.
|
private static HeaderPrintWriter |
logStream |
|
private static int |
MAX_REQUIRED_LEN |
|
private static int |
MGRLVL_3 |
|
private static int |
MGRLVL_4 |
|
private static int |
MGRLVL_5 |
|
private static int |
MGRLVL_6 |
|
private static int |
MGRLVL_7 |
|
private byte[] |
myPublicKey |
|
private byte[] |
myTargetSeed |
|
private static byte |
NULL_VALUE |
|
private static byte[] |
nullSQLState |
|
private int |
pendingStatementTimeout |
|
private DRDAString |
pkgcnstkn |
Current RDB Package Consistency Token.
|
private DRDAString |
pkgid |
Current RDB Package Identifier.
|
private int |
pkgsn |
Current RDB Package Section Number.
|
private static byte[] |
prdIdBytes |
|
private Pkgnamcsn |
prevPkgnamcsn |
The value returned by the previous call to
parsePKGNAMCSN() . |
private DRDAString |
rdbcolid |
Current RDB Collection Identifier.
|
private DRDAString |
rdbnam |
Current RDB Package Name.
|
private DDMReader |
reader |
|
private int[] |
required |
|
private static java.lang.String |
rightBrace |
|
private static int |
ROLLBACK |
|
private boolean |
sendWarningsOnCNTQRY |
|
private NetworkServerControlImpl |
server |
|
private Session |
session |
|
private java.io.InputStream |
sockis |
|
private java.io.OutputStream |
sockos |
|
private int |
sqlamLevel |
|
private static java.lang.String |
SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER |
SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER , When full message text is
sent for severe errors. |
private static java.lang.String |
SQLERRMC_TOKEN_DELIMITER |
SQLERRMC_TOKEN_DELIMITER separates message argument tokens |
private static java.lang.String |
SYNTAX_ERR |
|
private static java.lang.String |
TIMEOUT_STATEMENT |
|
private long |
timeSlice |
Time slice for this thread.
|
private java.util.List<java.lang.Integer> |
unknownManagers |
|
private static byte[] |
warn0_warnA |
|
private DDMWriter |
writer |
|
private DRDAXAProtocol |
xaProto |
Constructor | Description |
---|---|
DRDAConnThread(Session session,
NetworkServerControlImpl server,
long timeSlice,
boolean logConnections) |
Create a new Thread for processing session requests
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
agentError(java.lang.String msg) |
Agent error - something very bad happened
|
private void |
badObjectLength(int codePoint) |
Object length not allowed
|
private java.lang.String |
buildDataTruncationSqlerrmc(java.sql.DataTruncation dt) |
Build the SQLERRMC for a
java.sql.DataTruncation warning. |
private java.lang.String |
buildPreformattedSqlerrmc(java.sql.SQLException se) |
Build preformatted SQLException text
for severe exceptions or SQLExceptions that are not Derby exceptions.
|
protected java.lang.String |
buildRuntimeInfo(java.lang.String indent,
LocalizedResource localLangUtil) |
|
private java.lang.String |
buildSqlerrmc(java.sql.SQLException se) |
Create error message or message argements to return to client.
|
private java.lang.String |
buildTokenizedSqlerrmc(java.sql.SQLException se) |
Build Tokenized SQLERRMC to just send the tokenized arguments to the client.
|
private boolean |
canIgnoreStmt(java.lang.String stmt) |
|
private void |
checkLength(int codepoint,
int reqlen) |
Check that the length is equal to the required length for this codepoint
|
private void |
checkRequired(int codePoint) |
Check whether we have seen all the required code points
|
private void |
checkValidTypDefNam(java.lang.String typdefnam) |
check that the given typdefnam is acceptable
|
private void |
checkWarning(java.sql.Connection conn,
java.sql.Statement stmt,
java.sql.ResultSet rs,
long updateCount,
boolean alwaysSend,
boolean sendWarn) |
Check SQLWarning and write SQLCARD as needed.
|
private void |
cleanUpAndCloseResultSet(DRDAStatement stmt,
java.sql.SQLException sqle,
int writerMark) |
Cleans up and closes a result set if an exception is thrown
when collecting QRYDTA in response to OPNQRY or CNTQRY.
|
protected void |
close() |
Close DRDA connection thread
|
private boolean |
closed() |
Test if DRDA connection thread is closed
|
private void |
closeSession() |
Close the current session
|
private static void |
closeStream(java.io.InputStream stream) |
Close a stream.
|
protected void |
codePointNotSupported(int codePoint) |
Don't support this code point
|
private static java.io.InputStream |
convertAsByteArrayInputStream(EXTDTAReaderInputStream stream) |
|
private java.lang.String |
convertToHexString(byte[] buf) |
convert byte array to a Hex string
|
private void |
copyToRequired(int[] req) |
Copy a list of required code points to template for checking
|
private void |
doneData(DRDAStatement stmt,
java.sql.ResultSet rs) |
Done data
Send SQLCARD for the end of the data
|
private void |
errorInChain(java.sql.SQLException e) |
If there's a severe error in the DDM chain, and if the header indicates
"terminate chain on error", we stop processing further commands in the chain
nor do we send any reply for them.
|
private void |
exchangeServerAttributes() |
Exchange server attributes with application requester
|
private void |
finalizeChain() |
Finalize the current DSS chain and send it if
needed.
|
private static java.lang.Object |
findService(java.lang.String factoryInterface,
java.lang.String serviceName) |
Privileged service lookup.
|
private java.lang.String |
formatDate(java.sql.Date date) |
Convert a
java.sql.Date to a string with the format expected
by the client. |
private java.lang.String |
formatTime(java.sql.Time time) |
Convert a
java.sql.Time to a string with the format expected
by the client. |
private java.lang.String |
formatTimestamp(java.sql.Timestamp ts) |
Convert a
java.sql.Timestamp to a string with the format
expected by the client. |
private int |
getByteOrder() |
|
(package private) long |
getBytesRead() |
|
(package private) long |
getBytesWritten() |
|
private int |
getConnFromDatabaseName() |
Get connection from a database name
Username and password is verified by making a connection to the
database
|
protected int |
getCorrelationID() |
Get correlation id
|
protected byte[] |
getCrrtkn() |
Get correlation token
|
protected Database |
getDatabase() |
Get Database we are working on
|
protected java.lang.String |
getDbName() |
Get database name
|
private int |
getExceptionSeverity(java.sql.SQLException e) |
Translate from Derby exception severity to SVRCOD
|
private java.util.Calendar |
getGMTCalendar() |
Get a
Calendar instance with time zone set to GMT. |
protected java.io.InputStream |
getInputStream() |
Get input stream
|
private boolean |
getLogConnections() |
Get whether connections are logged
|
private static ModuleFactory |
getMonitor() |
Privileged Monitor lookup.
|
private java.lang.Object |
getObjectForWriteFdoca(java.sql.CallableStatement cs,
int index,
int drdaType) |
Get the value of an output parameter of the specified type from a
CallableStatement , in a form suitable for being writted by
writeFdocaVal(int, java.lang.Object, int, int, int, boolean, org.apache.derby.impl.drda.DRDAStatement, boolean) . |
private java.lang.Object |
getObjectForWriteFdoca(java.sql.ResultSet rs,
int index,
int drdaType) |
Get a column value of the specified type from a
ResultSet , in
a form suitable for being writted by writeFdocaVal(int, java.lang.Object, int, int, int, boolean, org.apache.derby.impl.drda.DRDAStatement, boolean) . |
protected java.io.OutputStream |
getOutputStream() |
Get output stream
|
private static byte[] |
getProductIDBytes() |
Get product id as bytes
|
private int |
getRdbAccessErrorCodePoint() |
|
protected DDMReader |
getReader() |
get DDMReader
|
protected NetworkServerControlImpl |
getServer() |
Get server
|
protected Session |
getSession() |
Get session we are working on
|
private int |
getSqlCode(java.sql.SQLException e) |
Get the SQLCODE to send for an exception or a warning.
|
private long |
getTimeSlice() |
Get time slice value for length of time to work on a session
|
protected DDMWriter |
getWriter() |
get DDMWriter
|
private void |
handleException(java.lang.Exception e) |
Handle Exceptions - write error protocol if appropriate and close session
or thread as appropriate
|
(package private) boolean |
hasSession() |
|
private void |
initialize() |
Initialize class
|
private void |
initializeDatabase(java.lang.String dbname) |
Create a new database and intialize the
DRDAConnThread database.
|
private void |
initializeForSession() |
Initialize for a new session
|
private void |
invalidClient(java.lang.String prdid) |
Invalid non-derby client tried to connect.
|
protected void |
invalidCodePoint(int codePoint) |
Invalid codepoint for this command
|
private void |
invalidValue(int codePoint) |
Invalid value for this code point
|
private boolean |
isAuthenticationException(java.sql.SQLException sqlException) |
There are multiple reasons for not getting a connection, and
all these should throw SQLExceptions with SQL state 08004
according to the SQL standard.
|
protected void |
markCommunicationsFailure(java.lang.Exception e,
java.lang.String arg1,
java.lang.String arg2,
java.lang.String arg3,
java.lang.String arg4) |
Indicate a communications failure.
|
protected void |
markCommunicationsFailure(java.lang.String arg1,
java.lang.String arg2,
java.lang.String arg3,
java.lang.String arg4) |
Indicate a communications failure
|
protected void |
missingCodePoint(int codePoint) |
Missing code point
|
private void |
padInt(char[] buf,
int offset,
int length,
int value) |
Insert an integer into a char array and pad it with leading zeros if
its string representation is shorter than
length characters. |
private int |
parseACCRDB() |
Parse access RDB
Instance variables
RDBACCCL - RDB Access Manager Class - required must be SQLAM
CRRTKN - Correlation Token - required
RDBNAM - Relational database name -required
PRDID - Product specific identifier - required
TYPDEFNAM - Data Type Definition Name -required
TYPDEFOVR - Type definition overrides -required
RDBALWUPD - RDB Allow Updates optional
PRDDTA - Product Specific Data - optional - ignorable
STTDECDEL - Statement Decimal Delimiter - optional
STTSTRDEL - Statement String Delimiter - optional
TRGDFTRT - Target Default Value Return - optional
|
private int |
parseACCSEC() |
Parse Access Security
If the target server supports the SECMEC requested by the application requester
then a single value is returned and it is identical to the SECMEC value
in the ACCSEC command.
|
private java.lang.String |
parseCcsidMBC(int length) |
Parse mixed character string
|
private java.lang.String |
parseCcsidSBC(int length) |
Parse single byte character string
|
private DRDAStatement |
parseCLSQRY() |
Parse CLSQRY
Instance Variables
RDBNAM - relational database name - optional
PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required
QRYINSID - Query Instance Identifier - required - level 7
MONITOR - Monitor events - optional.
|
private DRDAStatement |
parseCNTQRY() |
Parse CNTQRY - Continue Query
Instance Variables
RDBNAM - Relational Database Name - optional
PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required
QRYBLKSZ - Query Block Size - required
QRYRELSCR - Query Relative Scrolling Action - optional
QRYSCRORN - Query Scroll Orientation - optional - level 7
QRYROWNBR - Query Row Number - optional
QRYROWSNS - Query Row Sensitivity - optional - level 7
QRYBLKRST - Query Block Reset - optional - level 7
QRYRTNDTA - Query Returns Data - optional - level 7
QRYROWSET - Query Rowset Size - optional - level 7
QRYRFRTBL - Query Refresh Answer Set Table - optional
NBRROW - Number of Fetch or Insert Rows - optional
MAXBLKEXT - Maximum number of extra blocks - optional
RTNEXTDTA - Return of EXTDTA Option - optional
MONITOR - Monitor events - optional.
|
private void |
parseCNTQRYobjects(DRDAStatement stmt) |
Parse CNTQRY objects
Instance Variables
OUTOVR - Output Override Descriptor - optional
|
private java.sql.Date |
parseDate(java.lang.String dateString,
java.util.Calendar cal) |
Parse a date string as it is received from the client.
|
private boolean |
parseDRDAConnection() |
|
private boolean |
parseDSCSQLSTT() |
Parse DSCSQLSTT - Describe SQL Statement previously prepared
Instance Variables
TYPSQLDA - sqlda type expected (output or input)
RDBNAM - relational database name - optional
PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required
MONITOR - Monitor events - optional.
|
private java.lang.String |
parseEncodedString() |
Parse an encoded data string from the Application Requester
|
private void |
parseEXCSAT() |
Parses EXCSAT (Exchange Server Attributes)
Instance variables
EXTNAM(External Name) - optional
MGRLVLLS(Manager Levels) - optional
SPVNAM(Supervisor Name) - optional
SRVCLSNM(Server Class Name) - optional
SRVNAM(Server Name) - optional, ignorable
SRVRLSLV(Server Product Release Level) - optional, ignorable
|
private void |
parseEXCSAT2() |
Parses EXCSAT2 (Exchange Server Attributes)
Instance variables
EXTNAM(External Name) - optional
MGRLVLLS(Manager Levels) - optional
SPVNAM(Supervisor Name) - optional
SRVCLSNM(Server Class Name) - optional
SRVNAM(Server Name) - optional, ignorable
SRVRLSLV(Server Product Release Level) - optional, ignorable
|
private long |
parseEXCSQLIMM() |
Parse EXCSQLIMM - Execute Immediate Statement
Instance Variables
RDBNAM - relational database name - optional
PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required
RDBCMTOK - RDB Commit Allowed - optional
MONITOR - Monitor Events - optional
Command Objects
TYPDEFNAM - Data Type Definition Name - optional
TYPDEFOVR - TYPDEF Overrides -optional
SQLSTT - SQL Statement -required
|
private boolean |
parseEXCSQLSET() |
Parse EXCSQLSET - Execute Set SQL Environment
Instance Variables
RDBNAM - relational database name - optional
PKGNAMCT - RDB Package Name, Consistency Token - optional
MONITOR - Monitor Events - optional
Command Objects
TYPDEFNAM - Data Type Definition Name - required
TYPDEFOVR - TYPDEF Overrides - required
SQLSTT - SQL Statement - required (at least one; may be more)
|
private void |
parseEXCSQLSETobjects() |
Parse EXCSQLSET objects
Objects
TYPDEFNAM - Data type definition name - optional
TYPDEFOVR - Type defintion overrides - optional
SQLSTT - SQL Statement - required (a list of at least one)
Objects may follow in one DSS or in several DSS chained together.
|
private void |
parseEXCSQLSTT() |
Parse EXCSQLSTT - Execute non-cursor SQL Statement previously prepared
Instance Variables
RDBNAM - relational database name - optional
PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required
OUTEXP - Output expected
NBRROW - Number of rows to be inserted if it's an insert
PRCNAM - procedure name if specified by host variable, not needed for Derby
QRYBLKSZ - query block size
MAXRSLCNT - max resultset count
MAXBLKEXT - Max number of extra blocks
RSLSETFLG - resultset flag
RDBCMTOK - RDB Commit Allowed - optional
OUTOVROPT - output override option
QRYROWSET - Query Rowset Size - Level 7
MONITOR - Monitor events - optional.
|
private boolean |
parseEXCSQLSTTobjects(DRDAStatement stmt) |
Parse EXCSQLSTT command objects
Command Objects
TYPDEFNAM - Data Type Definition Name - optional
TYPDEFOVR - TYPDEF Overrides -optional
SQLDTA - optional, variable data, specified if prpared statement has input parameters
EXTDTA - optional, externalized FD:OCA data
OUTOVR - output override descriptor, not allowed for stored procedure calls
If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects
sent with the statement.
|
private java.lang.String |
parseEXECSQLIMMobjects() |
Parse EXCSQLIMM objects
Objects
TYPDEFNAM - Data type definition name - optional
TYPDEFOVR - Type defintion overrides
SQLSTT - SQL Statement required
If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects
sent with the statement.
|
private void |
parseMGRLVLLS(int time) |
Parse manager levels
Instance variables
MGRLVL - repeatable, required
CODEPOINT
CCSIDMGR - CCSID Manager
CMNAPPC - LU 6.2 Conversational Communications Manager
CMNSYNCPT - SNA LU 6.2 SyncPoint Conversational Communications Manager
CMNTCPIP - TCP/IP Communication Manager
DICTIONARY - Dictionary
RDB - Relational Database
RSYNCMGR - Resynchronization Manager
SECMGR - Security Manager
SQLAM - SQL Application Manager
SUPERVISOR - Supervisor
SYNCPTMGR - Sync Point Manager
VALUE
On the second appearance of this codepoint, it can only add managers
|
private void |
parseMONITOR() |
Parse MONITOR
DRDA spec says this is optional.
|
private java.lang.String |
parseNOCMorNOCS() |
Parse nullable character mixed byte or nullable character single byte
Format
1 byte - null indicator
I4 - mixed character length
N bytes - mixed character string
1 byte - null indicator
I4 - single character length
N bytes - single character length string
|
private Pkgnamcsn |
parseOPNQRY() |
Parse OPNQRY
Instance Variables
RDBNAM - relational database name - optional
PKGNAMCSN - RDB Package Name, Consistency Token and Section Number - required
QRYBLKSZ - Query Block Size - required
QRYBLKCTL - Query Block Protocol Control - optional
MAXBLKEXT - Maximum Number of Extra Blocks - optional - default value 0
OUTOVROPT - Output Override Option
QRYROWSET - Query Rowset Size - optional - level 7
MONITOR - Monitor events - optional.
|
private void |
parseOPNQRYobjects(DRDAStatement stmt) |
Parse OPNQRY objects
Objects
TYPDEFNAM - Data type definition name - optional
TYPDEFOVR - Type defintion overrides - optional
SQLDTA- SQL Program Variable Data - optional
If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects
sent with the statement.
|
private void |
parseOUTOVR(DRDAStatement stmt) |
Parse OUTOVR - Output Override Descriptor
This specifies the output format for data to be returned as output to a SQL
statement or as output from a query.
|
private int |
parseOUTOVROPT() |
Parse OUTOVROPT - this indicates whether output description can be
overridden on just the first CNTQRY or on any CNTQRY
|
private Pkgnamcsn |
parsePKGNAMCSN() |
Parse PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number
Instance Variables
NAMESYMDR - database name - not validated
RDBCOLID - RDB Collection Identifier
PKGID - RDB Package Identifier
PKGCNSTKN - RDB Package Consistency Token
PKGSN - RDB Package Section Number
|
private java.lang.String |
parsePKGNAMCT() |
|
private int |
parsePRPSQLSTT() |
Parse PRPSQLSTT - Prepare SQL Statement
Instance Variables
RDBNAM - Relational Database Name - optional
PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required
RTNSQLDA - Return SQL Descriptor Area - optional
MONITOR - Monitor events - optional.
|
private java.lang.String |
parsePRPSQLSTTobjects(DRDAStatement stmt) |
Parse PRPSQLSTT objects
Objects
TYPDEFNAM - Data type definition name - optional
TYPDEFOVR - Type defintion overrides - optional
SQLSTT - SQL Statement required
SQLATTR - Cursor attributes on prepare - optional - level 7
If TYPDEFNAM and TYPDEFOVR are supplied, they apply to the objects
sent with the statement.
|
private int |
parseQRYBLKSZ() |
Parse QRYBLSZ - this gives the maximum size of the query blocks that
can be returned to the requester
|
private int |
parseQRYCLSIMP() |
Parse a QRYCLSIMP - Implicitly close non-scrollable cursor
after end of data.
|
private int |
parseQRYCLSRLS() |
|
private int |
parseQRYROWSET(int minVal) |
Parse QRYROWSET - this is the number of rows to return
|
private void |
parseRDBCMTOK() |
Parse RDBCMTOK - tells the database whether to allow commits or rollbacks
to be executed as part of the command
Since we don't have a SQL commit or rollback command, we will just ignore
this for now
|
private java.lang.String |
parseRDBNAM() |
Parse database name
|
private int |
parseSECCHK() |
Parse security check
Instance Variables
SECMGRNM - security manager name - optional, ignorable
SECMEC - security mechanism - required
SECTKN - security token - optional, (required if encryption used)
PASSWORD - password - optional, (required if security mechanism uses it)
NEWPASSWORD - new password - optional, (required if sec mech. uses it)
USRID - user id - optional, (required if sec mec. uses it)
RDBNAM - database name - optional (required if databases can have own sec.)
|
protected void |
parseSQLATTR(DRDAStatement stmt) |
Parse SQLATTR - Cursor attributes on prepare
This is an encoded string.
|
private void |
parseSQLDTA(DRDAStatement stmt) |
Parse SQLDTA - SQL program variable data
and handle exception.
|
private void |
parseSQLDTA_work(DRDAStatement stmt) |
Parse SQLDTA - SQL program variable data
Instance Variables
FDODSC - FD:OCA data descriptor - required
FDODTA - FD:OCA data - optional
|
private java.lang.String |
parseSQLSTTDss() |
Parse SQLSTT Dss
|
private java.sql.Time |
parseTime(java.lang.String timeString,
java.util.Calendar cal) |
Parse a time string as it is received from the client.
|
private java.sql.Timestamp |
parseTimestamp(java.lang.String timeString,
java.util.Calendar cal) |
Parse a timestamp string as it is received from the client.
|
private java.lang.String |
parseTYPDEFNAM() |
Parse TYPDEFNAM
|
private void |
parseTYPDEFOVR(DRDAStatement st) |
Parse Type Defintion Overrides
TYPDEF Overrides specifies the Coded Character SET Identifiers (CCSIDs)
that are in a named TYPDEF.
|
private boolean |
parseTYPSQLDA() |
Parse TYPSQLDA - Type of the SQL Descriptor Area
|
private java.lang.String |
parseVCMorVCS() |
Parse variable character mixed byte or variable character single byte
Format
I2 - VCM Length
N bytes - VCM value
I2 - VCS Length
N bytes - VCS value
Only 1 of VCM length or VCS length can be non-zero
|
private boolean |
positionCursor(DRDAStatement stmt,
java.sql.ResultSet rs) |
Position cursor for insensitive scrollable cursors
|
protected static void |
println2Log(java.lang.String dbname,
java.lang.String drdaID,
java.lang.String msg) |
Print a line to the DB2j log
|
private void |
processCommands() |
Process DRDA commands we can receive once server attributes have been
exchanged.
|
private boolean |
processLeftoverQRYDTA(DRDAStatement stmt) |
Process remainder data resulting from a split.
|
private void |
rdbnamMismatch(int codePoint) |
Database name given under code point doesn't match previous database names
|
private void |
rdbNotFound(java.lang.String rdbnam) |
RDB not found
|
private void |
readAndSetAllExtParams(DRDAStatement stmt,
boolean streamLOB) |
|
private void |
readAndSetExtParam(int i,
DRDAStatement stmt,
int drdaType,
int extLen,
boolean streamLOB) |
Read different types of input parameters and set them in PreparedStatement
|
private void |
readAndSetParams(int i,
DRDAStatement stmt,
java.sql.ParameterMetaData pmeta) |
Read different types of input parameters and set them in
PreparedStatement
|
private boolean |
readBoolean(int codepoint) |
Read and check a boolean value
|
private long |
readLobLength(int extLenIndicator) |
|
private java.lang.Object |
readUDT() |
Read a UDT from the stream
|
private void |
removeFromRequired(int codePoint) |
Remove codepoint from required list
|
private void |
requiredValueNotFound(int codePoint) |
Required value not found.
|
void |
run() |
Main routine for thread, loops until the thread is closed
Gets a session, does work for the session
|
private void |
sendProtocolException(DRDAProtocolException de) |
Notice the client about a protocol error.
|
private void |
sendUnexpectedException(java.lang.Exception e) |
Send unpexpected error to the client
|
private void |
sessionInitialState() |
In initial state for a session,
determine whether this is a command
session or a DRDA protocol session.
|
private static void |
setAsBinaryStream(DRDAStatement stmt,
int index,
EXTDTAReaderInputStream stream,
boolean streamLOB) |
Sets the specified binary EXTDTA parameter of the embedded statement.
|
private static void |
setAsCharacterStream(DRDAStatement stmt,
int i,
EXTDTAReaderInputStream extdtaStream,
boolean streamLOB,
java.lang.String encoding) |
Sets the specified character EXTDTA parameter of the embedded statement.
|
private void |
setDatabase(int codePoint) |
Set the current database
|
protected void |
setLogConnections(boolean value) |
Set logging of connections
|
private void |
setStmtOrDbByteOrder(boolean setDatabase,
DRDAStatement stmt,
java.lang.String typDefNam) |
Set a statement or the database' byte order, depending on the arguments
|
protected void |
setTimeSlice(long value) |
Set time slice value
|
static void |
showmem() |
Show runtime memory
|
private void |
skipRemainder(boolean onlySkipSameIds) |
Skip remainder of current DSS and all chained DSS'es
|
private void |
splitQRYDTA(DRDAStatement stmt,
int blksize) |
Split QRYDTA into blksize chunks
This routine is called if the QRYDTA data will not fit.
|
private int |
svrcodFromSecchkcd(int securityCheckCode) |
Calculate SVRCOD value from SECCHKCD
|
private void |
switchToEbcdic() |
Switch the DDMWriter and DDMReader to EBCDIC
|
private void |
switchToUtf8() |
Switch the DDMWriter and DDMReader to UTF8 IF supported
|
protected void |
throwSyntaxrm(int errcd,
int cpArg) |
Syntax error
|
private void |
tooBig(int codePoint) |
Object too big
|
private void |
tooMany(int codePoint) |
Seen too many of this code point
|
protected void |
trace(java.lang.String value) |
Send string to console
|
private void |
traceEXTDTARead(int drdaType,
int index,
EXTDTAReaderInputStream stream,
boolean streamLOB,
java.lang.String encoding) |
Sends a trace string to the console when reading an EXTDTA value (if
tracing is enabled).
|
private int |
validateSecMecUSRSSBPWD() |
Validate SECMEC_USRSSBPWD (Strong Password Substitute) can be used as
DRDA security mechanism.
|
private void |
valueNotSupported(int codePoint) |
Don't support this value
|
private void |
verifyInOrderACCSEC_SECCHK(int codePoint,
int reqCodePoint) |
Verify that the code point is in the right order
|
private void |
verifyRequiredObject(int codePoint,
int reqCodePoint) |
Verify that the code point is the required code point
|
private int |
verifyUserIdPassword() |
Verify userId and password
Username and password is verified by making a connection to the
database
|
private void |
writeABNUOWRM() |
Write ABNUOWRM - query process has terminated in an error condition
such as deadlock or lock timeout.
|
private void |
writeACCRDBRM(int svrcod) |
Write Access to RDB Completed
Instance Variables
SVRCOD - severity code - 0 info, 4 warning -required
PRDID - product specific identifier -required
TYPDEFNAM - type definition name -required
TYPDEFOVR - type definition overrides - required
RDBINTTKN - token which can be used to interrupt DDM commands - optional
CRRTKN - correlation token - only returned if we didn't get one from requester
SRVDGN - server diagnostic information - optional
PKGDFTCST - package default character subtype - optional
USRID - User ID at the target system - optional
SRVLST - Server List
|
private void |
writeACCSECRD(int securityCheckCode) |
Write ACCSECRD
If the security mechanism is known, we just send it back along with
the security token if encryption is going to be used.
|
private void |
writeCMDCHKRM(int severity) |
Write CMDCHKRM
Instance Variables
SVRCOD - Severity Code - required
|
private void |
writeENDQRYRM(int svrCod) |
Write ENDQRYRM - query process has terminated in such a manner that the
query or result set is now closed.
|
private void |
writeENDUOWRM(int opType) |
Write ENDUOWRM
Instance Variables
SVCOD - severity code - WARNING - required
UOWDSP - Unit of Work Disposition - required
RDBNAM - Relational Database name - optional
SRVDGN - Server Diagnostics information - optional
|
private void |
writeEXCSATRD() |
Write reply to EXCSAT command
Instance Variables
EXTNAM - External Name (optional)
MGRLVLLS - Manager Level List (optional)
SRVCLSNM - Server Class Name (optional) - used by JCC
SRVNAM - Server Name (optional)
SRVRLSLV - Server Product Release Level (optional)
|
(package private) void |
writeEXTDTA(DRDAStatement stmt) |
|
protected void |
writeFdocaVal(int index,
java.lang.Object val,
int drdaType,
int precision,
int scale,
boolean valNull,
DRDAStatement stmt,
boolean isParam) |
Write Fdoca Value to client
|
private boolean |
writeFDODTA(DRDAStatement stmt) |
This routine places some data into the current QRYDTA block using
FDODTA (Formatted Data Object DaTA rules).
|
private void |
writeMGRLEVELS() |
Write manager levels
The target server must not provide information for any target
managers unless the source explicitly requests it.
|
private void |
writeNullability(int drdaType,
boolean valNull) |
write nullability if this is a nullable drdatype and FDOCA null
value if appropriate
|
private void |
writeNullSQLCARDobject() |
Write a null SQLCARD as an object
|
private void |
writeOPNQFLRM(java.sql.SQLException e) |
Write a OPNQFLRM - Open Query Failure
Instance Variables
SVRCOD - Severity Code - required - 8 ERROR
RDBNAM - Relational Database Name - required
|
private void |
writeOPNQRYRM(boolean isDssObject,
DRDAStatement stmt) |
Write OPNQRYRM - Open Query Complete
Instance Variables
SVRCOD - Severity Code - required
QRYPRCTYP - Query Protocol Type - required
SQLCSRHLD - Hold Cursor Position - optional
QRYATTSCR - Query Attribute for Scrollability - optional - level 7
QRYATTSNS - Query Attribute for Sensitivity - optional - level 7
QRYATTUPD - Query Attribute for Updatability -optional - level 7
QRYINSID - Query Instance Identifier - required - level 7
SRVDGN - Server Diagnostic Information - optional
|
private void |
writePBSD() |
Piggy-back any modified session attributes on the current message.
|
private void |
writePKGNAMCSN() |
|
private void |
writePKGNAMCSN(byte[] pkgcnstkn) |
Write PKGNAMCSN
Instance Variables
NAMESYMDR - database name - not validated
RDBCOLID - RDB Collection Identifier
PKGID - RDB Package Identifier
PKGCNSTKN - RDB Package Consistency Token
PKGSN - RDB Package Section Number
There are two possible formats, fixed and extended which includes length
information for the strings
|
private void |
writeQRYDSC(DRDAStatement stmt,
boolean FDODSConly) |
Write QRYDSC - Query Answer Set Description
|
private void |
writeQRYDTA(DRDAStatement stmt) |
Write QRYDTA - Query Answer Set Data
Contains some or all of the answer set data resulting from a query
If the client is not using rowset processing, this routine attempts
to pack as much data into the QRYDTA as it can.
|
private void |
writeQRYNOPRM(int svrCod) |
Write a QRYNOPRM - Query Not Opened
Instance Variables
SVRCOD - Severity Code - required - 4 Warning 8 ERROR
RDBNAM - Relational Database Name - required
PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required
|
private void |
writeQRYPOPRM() |
Write a QRYPOPRM - Query Previously opened
Instance Variables
SVRCOD - Severity Code - required - 8 ERROR
RDBNAM - Relational Database Name - required
PKGNAMCSN - RDB Package Name, Consistency Token, and Section Number - required
|
private void |
writeRDBfailure(int codePoint) |
Write RDB Failure
Instance Variables
SVRCOD - Severity Code - required
RDBNAM - Relational Database name - required
SRVDGN - Server Diagnostics - optional (not sent for now)
|
protected void |
writeRDBNAM(java.lang.String rdbnam) |
Write RDBNAM
|
private void |
writeRDBUPDRM() |
Write RDBUPDRM
Instance variables
SVRCOD - Severity code - Information only - required
RDBNAM - Relational database name -required
SRVDGN - Server Diagnostic Information -optional
|
private void |
writeRSLSETRM(DRDAStatement stmt) |
Write RSLSETRM
Instance variables
SVRCOD - Severity code - Information only - required
PKGSNLST - list of PKGNAMCSN -required
SRVDGN - Server Diagnostic Information -optional
|
private void |
writeSECCHKRM(int securityCheckCode) |
Write security check reply
Instance variables
SVRCOD - serverity code - required
SECCHKCD - security check code - required
SECTKN - security token - optional, ignorable
SVCERRNO - security service error number
SRVDGN - Server Diagnostic Information
|
private void |
writeSQLCAERRWARN(long updateCount,
long rowCount) |
Write the ERR and WARN part of the SQLCA
|
private void |
writeSQLCAGRP(byte[] sqlState,
int sqlcode,
long updateCount,
long rowCount) |
Same as writeSQLCAGRP, but optimized for the case
when there is no real exception, i.e. the exception is null, or "End
of data"
SQLCAGRP : FDOCA EARLY GROUP
SQL Communcations Area Group Description
FORMAT FOR SQLAM <= 6
SQLCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLSTATE; DRDA TYPE FCS; ENVLID 0x30; Length Override 5
SQLERRPROC; DRDA TYPE FCS; ENVLID 0x30; Length Override 8
SQLCAXGRP; DRDA TYPE N-GDA; ENVLID 0x52; Length Override 0
FORMAT FOR SQLAM >= 7
SQLCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLSTATE; DRDA TYPE FCS; ENVLID 0x30; Length Override 5
SQLERRPROC; DRDA TYPE FCS; ENVLID 0x30; Length Override 8
SQLCAXGRP; DRDA TYPE N-GDA; ENVLID 0x52; Length Override 0
SQLDIAGGRP; DRDA TYPE N-GDA; ENVLID 0x56; Length Override 0
|
private void |
writeSQLCAGRP(java.sql.SQLException e,
long updateCount,
long rowCount) |
Write SQLCAGRP
SQLCAGRP : FDOCA EARLY GROUP
SQL Communcations Area Group Description
FORMAT FOR SQLAM <= 6
SQLCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLSTATE; DRDA TYPE FCS; ENVLID 0x30; Length Override 5
SQLERRPROC; DRDA TYPE FCS; ENVLID 0x30; Length Override 8
SQLCAXGRP; DRDA TYPE N-GDA; ENVLID 0x52; Length Override 0
FORMAT FOR SQLAM >= 7
SQLCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLSTATE; DRDA TYPE FCS; ENVLID 0x30; Length Override 5
SQLERRPROC; DRDA TYPE FCS; ENVLID 0x30; Length Override 8
SQLCAXGRP; DRDA TYPE N-GDA; ENVLID 0x52; Length Override 0
SQLDIAGGRP; DRDA TYPE N-GDA; ENVLID 0x56; Length Override 0
|
private void |
writeSQLCARD(java.sql.SQLException e,
long updateCount,
long rowCount) |
|
private void |
writeSQLCARDs(java.sql.SQLException e,
long updateCount) |
|
private void |
writeSQLCARDs(java.sql.SQLException e,
long updateCount,
boolean sendSQLERRRM) |
|
private void |
writeSQLCAXGRP(long updateCount,
long rowCount,
java.lang.String sqlerrmc,
java.sql.SQLException nextException) |
Write SQLCAXGRP
SQLCAXGRP : EARLY FDOCA GROUP
SQL Communications Area Exceptions Group Description
FORMAT FOR SQLAM <= 6
SQLRDBNME; DRDA TYPE FCS; ENVLID 0x30; Length Override 18
SQLERRD1; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD2; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD3; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD4; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD5; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD6; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLWARN0; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN1; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN2; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN3; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN4; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN5; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN6; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN7; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN8; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN9; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARNA; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLERRMSG_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 70
SQLERRMSG_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 70
FORMAT FOR SQLAM >= 7
SQLERRD1; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD2; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD3; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD4; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD5; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLERRD6; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLWARN0; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN1; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN2; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN3; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN4; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN5; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN6; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN7; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN8; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARN9; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLWARNA; DRDA TYPE FCS; ENVLID 0x30; Length Override 1
SQLRDBNAME; DRDA TYPE VCS; ENVLID 0x32; Length Override 1024
SQLERRMSG_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 70
SQLERRMSG_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 70
|
private void |
writeSQLCINRD(DRDAStatement stmt) |
Write SQLCINRD - result set column information
|
private void |
writeSQLDAGRP(java.sql.ResultSetMetaData rsmeta,
java.sql.ParameterMetaData pmeta,
int elemNum,
boolean rtnOutput) |
Write SQLDAGRP
SQLDAGRP : EARLY FDOCA GROUP
SQL Data Area Group Description
FORMAT FOR SQLAM <= 6
SQLPRECISION; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLSCALE; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLLENGTH; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLTYPE; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLCCSID; DRDA TYPE FB; ENVLID 0x26; Length Override 2
SQLNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30
SQLNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30
SQLLABEL_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30
SQLLABEL_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30
SQLCOMMENTS_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 254
SQLCOMMENTS_m; DRDA TYPE VCS; ENVLID 0x32; Length Override 254
FORMAT FOR SQLAM == 6
SQLPRECISION; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLSCALE; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLLENGTH; DRDA TYPE I8; ENVLID 0x16; Length Override 8
SQLTYPE; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLCCSID; DRDA TYPE FB; ENVLID 0x26; Length Override 2
SQLNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30
SQLNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30
SQLLABEL_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 30
SQLLABEL_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 30
SQLCOMMENTS_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 254
SQLCOMMENTS_m; DRDA TYPE VCS; ENVLID 0x32; Length Override 254
SQLUDTGRP; DRDA TYPE N-GDA; ENVLID 0x51; Length Override 0
FORMAT FOR SQLAM >= 7
SQLPRECISION; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLSCALE; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLLENGTH; DRDA TYPE I8; ENVLID 0x16; Length Override 8
SQLTYPE; DRDA TYPE I2; ENVLID 0x04; Length Override 2
SQLCCSID; DRDA TYPE FB; ENVLID 0x26; Length Override 2
SQLDOPTGRP; DRDA TYPE N-GDA; ENVLID 0xD2; Length Override 0
|
private void |
writeSQLDARD(DRDAStatement stmt,
boolean rtnOutput,
java.sql.SQLException e) |
Write SQLDARD
SQLDARD : FDOCA EARLY ARRAY
SQL Descriptor Area Row Description with SQL Communications Area
FORMAT FOR SQLAM <= 6
SQLCARD; ROW LID 0x64; ELEMENT TAKEN 0(all); REP FACTOR 1
SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1
SQLDAROW; ROW LID 0x60; ELEMENT TAKEN 0(all); REP FACTOR 0(all)
FORMAT FOR SQLAM >= 7
SQLCARD; ROW LID 0x64; ELEMENT TAKEN 0(all); REP FACTOR 1
SQLDHROW; ROW LID 0xE0; ELEMENT TAKEN 0(all); REP FACTOR 1
SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1
|
private void |
writeSQLDCGRP(long rowNum,
int sqlCode,
java.lang.String sqlState,
java.lang.String dbname,
java.lang.String sqlerrmc) |
writeSQLDCGRP: SQL Diagnostics Condition Group Description
SQLDCCODE; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCSTATE; DRDA TYPE FCS; ENVLID Ox30; Lengeh Override 5
SQLDCREASON; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCLINEN; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCROWN; DRDA TYPE FD; ENVLID 0x0E; Lengeh Override 31
SQLDCER01; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCER02; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCER03; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCER04; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCPART; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCPPOP; DRDA TYPE I4; ENVLID 0x02; Length Override 4
SQLDCMSGID; DRDA TYPE FCS; ENVLID 0x30; Length Override 10
SQLDCMDE; DRDA TYPE FCS; ENVLID 0x30; Length Override 8
SQLDCPMOD; DRDA TYPE FCS; ENVLID 0x30; Length Override 5
SQLDCRDB; DRDA TYPE VCS; ENVLID 0x32; Length Override 255
SQLDCTOKS; DRDA TYPE N-RLO; ENVLID 0xF7; Length Override 0
SQLDCMSG_m; DRDA TYPE NVMC; ENVLID 0x3F; Length Override 32672
SQLDCMSG_S; DRDA TYPE NVCS; ENVLID 0x33; Length Override 32672
SQLDCCOLN_m; DRDA TYPE NVCM ; ENVLID 0x3F; Length Override 255
SQLDCCOLN_s; DRDA TYPE NVCS; ENVLID 0x33; Length Override 255
SQLDCCURN_m; DRDA TYPE NVCM; ENVLID 0x3F; Length Override 255
SQLDCCURN_s; DRDA TYPE NVCS; ENVLID 0x33; Length Override 255
SQLDCPNAM_m; DRDA TYPE NVCM; ENVLID 0x3F; Length Override 255
SQLDCPNAM_s; DRDA TYPE NVCS; ENVLID 0x33; Length Override 255
SQLDCXGRP; DRDA TYPE N-GDA; ENVLID 0xD3; Length Override 1
|
private void |
writeSQLDCROW(long rowNum,
int sqlCode,
java.lang.String sqlState,
java.lang.String dbname,
java.lang.String sqlerrmc) |
writeSQLDCROW: SQL Diagnostics Condition Row - Identity 0xE5
SQLDCGRP; GROUP LID 0xD5; ELEMENT TAKEN 0(all); REP FACTOR 1
|
private void |
writeSQLDHROW(int holdability) |
Holdability passed in as it can represent the holdability of
the statement or a specific result set.
|
private void |
writeSQLDIAGCI(java.sql.SQLException nextException) |
writeSQLDIAGCI: SQL Diagnostics Condition Information Array - Identity 0xF5
SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1
SQLDCIROW; ROW LID 0xE5; ELEMENT TAKEN 0(all); REP FACTOR 0(all)
|
private void |
writeSQLDIAGCN() |
|
private void |
writeSQLDIAGGRP(java.sql.SQLException nextException) |
Write SQLDIAGGRP: SQL Diagnostics Group Description - Identity 0xD1
Nullable Group
SQLDIAGSTT; DRDA TYPE N-GDA; ENVLID 0xD3; Length Override 0
SQLDIAGCN; DRFA TYPE N-RLO; ENVLID 0xF6; Length Override 0
SQLDIAGCI; DRDA TYPE N-RLO; ENVLID 0xF5; Length Override 0
|
private void |
writeSQLDIAGSTT() |
|
private void |
writeSQLDOPTGRP(java.sql.ResultSetMetaData rsmeta,
java.sql.ParameterMetaData pmeta,
int jdbcElemNum,
boolean rtnOutput) |
|
private void |
writeSQLDTAGRP(DRDAStatement stmt,
java.sql.ResultSetMetaData rsmeta,
java.sql.ParameterMetaData pmeta,
int colStart,
int colEnd,
boolean first) |
Write SQLDTAGRP
SQLDAGRP : Late FDOCA GROUP
SQL Data Value Group Descriptor
LENGTH - length of the SQLDTAGRP
TRIPLET_TYPE - NGDA for first, CPT for following
ID - SQLDTAGRP_LID for first, NULL_LID for following
For each column
DRDA TYPE
LENGTH OVERRIDE
For numeric/decimal types
PRECISON
SCALE
otherwise
LENGTH or DISPLAY_WIDTH
|
private void |
writeSQLDXGRP(java.sql.ResultSetMetaData rsmeta,
java.sql.ParameterMetaData pmeta,
int jdbcElemNum,
boolean rtnOutput) |
|
private void |
writeSQLERRRM(int severity) |
Write SQLERRRM
Instance Variables
SVRCOD - Severity Code - required
|
private void |
writeSQLNUMGRP(java.sql.SQLException nextException) |
writeSQLNUMGRP: Writes SQLNUMGRP : FDOCA EARLY GROUP
SQL Number of Elements Group Description
FORMAT FOR ALL SQLAM LEVELS
SQLNUM; DRDA TYPE I2; ENVLID 0x04; Length Override 2
|
private void |
writeSQLNUMROW(java.sql.SQLException nextException) |
writeSQLNUMROW: Writes SQLNUMROW : FDOCA EARLY ROW
SQL Number of Elements Row Description
FORMAT FOR SQLAM LEVELS
SQLNUMGRP; GROUP LID 0x58; ELEMENT TAKEN 0(all); REP FACTOR 1
|
private void |
writeSQLRSLRD(DRDAStatement stmt) |
Write SQLRSLRD - result set reply data
|
private void |
writeSQLUDTGRP(java.sql.ResultSetMetaData rsmeta,
java.sql.ParameterMetaData pmeta,
int jdbcElemNum,
boolean rtnOutput) |
Write SQLUDTGRP (SQL Descriptor User-Defined Type Group Descriptor)
This is the format from the DRDA spec, Volume 1, section 5.6.4.10.
|
private void |
writeTYPDEFOVR() |
|
private void |
writeVCMorVCS(java.lang.String s) |
Write variable character mixed byte or single byte
The preference is to write mixed byte if it is defined for the server,
since that is our default and we don't allow it to be changed, we always
write mixed byte.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private static final java.lang.String leftBrace
private static final java.lang.String rightBrace
private static final byte NULL_VALUE
private static final java.lang.String SYNTAX_ERR
private static final int MGRLVL_3
private static final int MGRLVL_4
private static final int MGRLVL_5
private static final int MGRLVL_6
private static final int MGRLVL_7
private static final int COMMIT
private static final int ROLLBACK
private int correlationID
private java.io.InputStream sockis
private java.io.OutputStream sockos
private DDMReader reader
private DDMWriter writer
private DRDAXAProtocol xaProto
private static int[] ACCRDB_REQUIRED
private static int MAX_REQUIRED_LEN
private int currentRequiredLength
private int[] required
private NetworkServerControlImpl server
private Session session
private volatile long timeSlice
private volatile boolean logConnections
private boolean sendWarningsOnCNTQRY
private volatile boolean close
private static HeaderPrintWriter logStream
private AppRequester appRequester
private Database database
private int sqlamLevel
private byte diagnosticLevel
private java.util.List<java.lang.Integer> unknownManagers
private java.util.List<java.lang.Integer> knownManagers
private java.sql.SQLException databaseAccessException
private Pkgnamcsn prevPkgnamcsn
parsePKGNAMCSN()
.private DRDAString rdbnam
private DRDAString rdbcolid
private DRDAString pkgid
private DRDAString pkgcnstkn
private int pkgsn
private static final java.lang.String TIMEOUT_STATEMENT
private int pendingStatementTimeout
private static DecryptionManager decryptionManager
private byte[] myPublicKey
private byte[] myTargetSeed
private static byte[] prdIdBytes
private static final byte[] eod00000
private static final byte[] eod02000
private static final byte[] nullSQLState
private static final byte[] errD5_D6
private static final byte[] warn0_warnA
private static final java.lang.String AUTHENTICATION_PROVIDER_BUILTIN_CLASS
private static final java.lang.String AUTHENTICATION_PROVIDER_NONE_CLASS
private static final DRDAProtocolExceptionInfo dummy
private boolean deferredReset
The bug manifests itself when a connection pool data source is used and logical connections are obtained from the physical connection associated with the data source. Each new logical connection causes a new physical connection on the server, including a new transaction. These connections and transactions are not closed / cleaned up.
private java.util.Calendar gmtCalendar
Calendar
instance using the GMT time zone.private static java.lang.String SQLERRMC_TOKEN_DELIMITER
SQLERRMC_TOKEN_DELIMITER
separates message argument tokensprivate static java.lang.String SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER
SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER
, When full message text is
sent for severe errors. This value separates the messages.DRDAConnThread(Session session, NetworkServerControlImpl server, long timeSlice, boolean logConnections)
session
- Session requesting processingserver
- Server starting threadtimeSlice
- timeSlice for threadlogConnections
- public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected java.io.InputStream getInputStream()
protected java.io.OutputStream getOutputStream()
private static byte[] getProductIDBytes()
protected DDMReader getReader()
protected DDMWriter getWriter()
protected int getCorrelationID()
protected Session getSession()
protected Database getDatabase()
protected NetworkServerControlImpl getServer()
protected byte[] getCrrtkn()
protected java.lang.String getDbName()
protected void close()
protected void setLogConnections(boolean value)
value
- value to set for logging connectionsprotected void setTimeSlice(long value)
value
- new value for time sliceprotected void markCommunicationsFailure(java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4) throws DRDAProtocolException
arg1
- - info about the communications failurearg2
- - info about the communications failurearg3
- - info about the communications failurearg4
- - info about the communications failureDRDAProtocolException
- disconnect exception always thrownprotected void markCommunicationsFailure(java.lang.Exception e, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4) throws DRDAProtocolException
e
- - Source exception that was thrownarg1
- - info about the communications failurearg2
- - info about the communications failurearg3
- - info about the communications failurearg4
- - info about the communications failureDRDAProtocolException
- disconnect exception always thrownprotected void throwSyntaxrm(int errcd, int cpArg) throws DRDAProtocolException
errcd
- Error codecpArg
- code point valueDRDAProtocolException
protected void agentError(java.lang.String msg) throws DRDAProtocolException
msg
- Message describing errorDRDAProtocolException
- newAgentError always thrownprotected void missingCodePoint(int codePoint) throws DRDAProtocolException
codePoint
- code point valueDRDAProtocolException
protected static void println2Log(java.lang.String dbname, java.lang.String drdaID, java.lang.String msg)
dbname
- database namedrdaID
- DRDA identifiermsg
- messageprotected void writeRDBNAM(java.lang.String rdbnam) throws DRDAProtocolException
rdbnam
- database nameDRDAProtocolException
private void initialize()
private void initializeForSession()
private void sessionInitialState() throws java.lang.Exception
java.lang.Exception
private void cleanUpAndCloseResultSet(DRDAStatement stmt, java.sql.SQLException sqle, int writerMark) throws DRDAProtocolException
stmt
- the DRDA statement to clean upsqle
- the exception that was thrownwriterMark
- start index for the first DSS to clear from
the output bufferDRDAProtocolException
- if a DRDA protocol error is
detectedprivate void processCommands() throws DRDAProtocolException
DRDAProtocolException
private void errorInChain(java.sql.SQLException e) throws DRDAProtocolException
e
- the SQLException raisedDRDAProtocolException
private void exchangeServerAttributes() throws DRDAProtocolException
DRDAProtocolException
private boolean parseDRDAConnection() throws DRDAProtocolException
DRDAProtocolException
private void switchToUtf8()
private void switchToEbcdic()
private void writeRDBfailure(int codePoint) throws DRDAProtocolException
codePoint
- codepoint of failureDRDAProtocolException
private int getRdbAccessErrorCodePoint()
private boolean isAuthenticationException(java.sql.SQLException sqlException)
sqlException
- The exception that is checked to see if
this is really caused by an authentication failureSQLState
private int verifyUserIdPassword() throws DRDAProtocolException
DRDAProtocolException
private int getConnFromDatabaseName() throws DRDAProtocolException
DRDAProtocolException
private void parseEXCSAT() throws DRDAProtocolException
DRDAProtocolException
private void parseEXCSAT2() throws DRDAProtocolException
DRDAProtocolException
- This parses a second occurrence of an EXCSAT command
The target must ignore the values for extnam, srvclsnm, srvnam and srvrlslv.
I am also going to ignore spvnam since it should be null anyway.
Only new managers can be added.private void parseMGRLVLLS(int time) throws DRDAProtocolException
time
- 1 for first time this is seen, 2 for subsequent onesDRDAProtocolException
private void writeEXCSATRD() throws DRDAProtocolException
DRDAProtocolException
private void writeMGRLEVELS() throws DRDAProtocolException
DRDAProtocolException
private int parseACCSEC() throws DRDAProtocolException
DRDAProtocolException
private Pkgnamcsn parseOPNQRY() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void parseOPNQRYobjects(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private int parseOUTOVROPT() throws DRDAProtocolException
DRDAProtocolException
private int parseQRYBLKSZ() throws DRDAProtocolException
DRDAProtocolException
private int parseQRYROWSET(int minVal) throws DRDAProtocolException
minVal
- - minimum valueDRDAProtocolException
private int parseQRYCLSIMP() throws DRDAProtocolException
DRDAProtocolException
private int parseQRYCLSRLS() throws DRDAProtocolException
DRDAProtocolException
private void writeQRYPOPRM() throws DRDAProtocolException
DRDAProtocolException
private void writeQRYNOPRM(int svrCod) throws DRDAProtocolException
svrCod
- Severity CodeDRDAProtocolException
private void writeOPNQFLRM(java.sql.SQLException e) throws DRDAProtocolException
e
- Exception describing failureDRDAProtocolException
private void writePKGNAMCSN(byte[] pkgcnstkn) throws DRDAProtocolException
DRDAProtocolException
private void writePKGNAMCSN() throws DRDAProtocolException
DRDAProtocolException
private DRDAStatement parseCNTQRY() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void skipRemainder(boolean onlySkipSameIds) throws DRDAProtocolException
onlySkipSameIds
- True if we _only_ want to skip DSS'es
that are chained with the SAME id as the current DSS.
False means skip ALL chained DSSes, whether they're
chained with same or different ids.DRDAProtocolException
private void parseCNTQRYobjects(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
stmt
- DRDA statement we are working onDRDAProtocolException
java.sql.SQLException
private void parseOUTOVR(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
stmt
- DRDA statement this applies toDRDAProtocolException
java.sql.SQLException
private void writePBSD() throws java.sql.SQLException, DRDAProtocolException
java.sql.SQLException
DRDAProtocolException
private void writeOPNQRYRM(boolean isDssObject, DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
isDssObject
- - return as a DSS object (part of a reply)stmt
- - DRDA statement we are processingDRDAProtocolException
java.sql.SQLException
private void writeENDQRYRM(int svrCod) throws DRDAProtocolException
svrCod
- Severity code - WARNING or ERRORDRDAProtocolException
private void writeABNUOWRM() throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parseRDBNAM() throws DRDAProtocolException
DRDAProtocolException
private void writeACCSECRD(int securityCheckCode) throws DRDAProtocolException
securityCheckCode
- DRDAProtocolException
private int parseSECCHK() throws DRDAProtocolException
DRDAProtocolException
private void writeSECCHKRM(int securityCheckCode) throws DRDAProtocolException
DRDAProtocolException
private int svrcodFromSecchkcd(int securityCheckCode)
securityCheckCode
- private int parseACCRDB() throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parseTYPDEFNAM() throws DRDAProtocolException
DRDAProtocolException
private void setStmtOrDbByteOrder(boolean setDatabase, DRDAStatement stmt, java.lang.String typDefNam)
setDatabase
- if true, set database' byte order, otherwise set statement'sstmt
- DRDAStatement, used when setDatabase is falsetypDefNam
- TYPDEFNAM valueprivate void writeACCRDBRM(int svrcod) throws DRDAProtocolException
DRDAProtocolException
private void writeTYPDEFOVR() throws DRDAProtocolException
DRDAProtocolException
private void parseTYPDEFOVR(DRDAStatement st) throws DRDAProtocolException
st
- Statement this TYPDEFOVR applies toDRDAProtocolException
private int parsePRPSQLSTT() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private java.lang.String parsePRPSQLSTTobjects(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private boolean parseTYPSQLDA() throws DRDAProtocolException
DRDAProtocolException
protected void parseSQLATTR(DRDAStatement stmt) throws DRDAProtocolException
stmt
- DRDAStatementDRDAProtocolException
private boolean parseDSCSQLSTT() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void parseEXCSQLSTT() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void parseRDBCMTOK() throws DRDAProtocolException
DRDAProtocolException
private boolean parseEXCSQLSTTobjects(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
stmt
- the DRDAStatement to executeDRDAProtocolException
java.sql.SQLException
private void writeSQLCINRD(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void writeSQLRSLRD(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void writeRSLSETRM(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void parseSQLDTA(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
parseSQLDTA_work(org.apache.derby.impl.drda.DRDAStatement)
private void parseSQLDTA_work(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private int getByteOrder()
private java.util.Calendar getGMTCalendar()
Calendar
instance with time zone set to GMT. The instance
is cached for reuse by this thread. This calendar can be used to
consistently read and write date and time values using the same
calendar. Since the local default calendar may not be able to represent
all times (for instance because the time would fall into a non-existing
hour of the day when switching to daylight saving time, see DERBY-4582),
we use the GMT time zone which doesn't observe daylight saving time.private void readAndSetParams(int i, DRDAStatement stmt, java.sql.ParameterMetaData pmeta) throws DRDAProtocolException, java.sql.SQLException
i
- index of the parameterstmt
- drda statementpmeta
- parameter meta dataDRDAProtocolException
java.sql.SQLException
private java.lang.Object readUDT() throws DRDAProtocolException
DRDAProtocolException
private long readLobLength(int extLenIndicator) throws DRDAProtocolException
DRDAProtocolException
private java.sql.Date parseDate(java.lang.String dateString, java.util.Calendar cal)
dateString
- the date string to parsecal
- the calendar in which the date is parsedjava.lang.IllegalArgumentException
- if the date is not correctly formattedDateTime.dateToDateBytes(byte[], int, org.apache.derby.client.am.DateTimeValue)
private java.sql.Time parseTime(java.lang.String timeString, java.util.Calendar cal)
timeString
- the time string to parsecal
- the calendar in which the time is parsedjava.lang.IllegalArgumentException
- if the time is not correctly formattedDateTime.timeToTimeBytes(byte[], int, org.apache.derby.client.am.DateTimeValue)
private java.sql.Timestamp parseTimestamp(java.lang.String timeString, java.util.Calendar cal)
timeString
- the time string to parsecal
- the calendar in which the timestamp is parsedjava.lang.IllegalArgumentException
- if the timestamp is not correctly
formattedDateTime.timestampToTimestampBytes(byte[], int, org.apache.derby.client.am.DateTimeValue, boolean)
private void readAndSetAllExtParams(DRDAStatement stmt, boolean streamLOB) throws java.sql.SQLException, DRDAProtocolException
java.sql.SQLException
DRDAProtocolException
private void readAndSetExtParam(int i, DRDAStatement stmt, int drdaType, int extLen, boolean streamLOB) throws DRDAProtocolException, java.sql.SQLException
i
- zero-based index of the parameterstmt
- associated psdrdaType
- drda type of the parameterDRDAProtocolException
java.sql.SQLException
private long parseEXCSQLIMM() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private boolean parseEXCSQLSET() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private java.lang.String parseEXECSQLIMMobjects() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void parseEXCSQLSETobjects() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private boolean canIgnoreStmt(java.lang.String stmt)
private void writeRDBUPDRM() throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parsePKGNAMCT() throws DRDAProtocolException
DRDAProtocolException
private Pkgnamcsn parsePKGNAMCSN() throws DRDAProtocolException
Pkgnamcsn
valueDRDAProtocolException
private java.lang.String parseSQLSTTDss() throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parseEncodedString() throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parseVCMorVCS() throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parseNOCMorNOCS() throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parseCcsidMBC(int length) throws DRDAProtocolException
DRDAProtocolException
private java.lang.String parseCcsidSBC(int length) throws DRDAProtocolException
DRDAProtocolException
private DRDAStatement parseCLSQRY() throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void parseMONITOR() throws DRDAProtocolException
DRDAProtocolException
private void writeSQLCARDs(java.sql.SQLException e, long updateCount) throws DRDAProtocolException
DRDAProtocolException
private void writeSQLCARDs(java.sql.SQLException e, long updateCount, boolean sendSQLERRRM) throws DRDAProtocolException
DRDAProtocolException
private int getSqlCode(java.sql.SQLException e)
Get the SQLCODE to send for an exception or a warning.
The client expects a negative SQLCODE for exceptions and a positive
SQLCODE for warnings. SQLCODE 0 means there is no error or warning
condition. SQLCODE is also used to encode the severity of the condition
(as returned by SQLException.getErrorCode()
).
For warnings, the SQLCODE is 10000, which is identical to
ExceptionSeverity.WARNING_SEVERITY
.
For exceptions, the SQLCODE is set to -severity-1
, which allows
all non-negative severity values to be encoded. (Derby only uses
non-negative severity values in the first place.)
e
- the exception or warning to get the SQLCODE forprivate void writeSQLCARD(java.sql.SQLException e, long updateCount, long rowCount) throws DRDAProtocolException
DRDAProtocolException
private void writeNullSQLCARDobject() throws DRDAProtocolException
DRDAProtocolException
private void writeSQLERRRM(int severity) throws DRDAProtocolException
severity
- severity of errorDRDAProtocolException
private void writeCMDCHKRM(int severity) throws DRDAProtocolException
severity
- severity of errorDRDAProtocolException
private int getExceptionSeverity(java.sql.SQLException e)
e
- SQLExceptionprivate void writeSQLCAGRP(java.sql.SQLException e, long updateCount, long rowCount) throws DRDAProtocolException
e
- SQLException encounteredDRDAProtocolException
private void writeSQLCAGRP(byte[] sqlState, int sqlcode, long updateCount, long rowCount) throws DRDAProtocolException
sqlState
- SQLState (already converted to UTF8)sqlcode
- sqlcodeupdateCount
- rowCount
- DRDAProtocolException
private java.lang.String buildSqlerrmc(java.sql.SQLException se)
se
- SQLException to build SQLERRMCprivate java.lang.String buildPreformattedSqlerrmc(java.sql.SQLException se)
se
- SQLException for which to build SQLERRMCprivate java.lang.String buildTokenizedSqlerrmc(java.sql.SQLException se)
se
- SQLException to printprivate java.lang.String buildDataTruncationSqlerrmc(java.sql.DataTruncation dt)
java.sql.DataTruncation
warning.
Serialize all the fields of the DataTruncation
instance in the
order in which they appear in the parameter list of the constructor.dt
- the DataTruncation
instance to serializeprivate void writeSQLCAXGRP(long updateCount, long rowCount, java.lang.String sqlerrmc, java.sql.SQLException nextException) throws DRDAProtocolException
nextException
- SQLException encounteredsqlerrmc
- sqlcodeDRDAProtocolException
private void writeSQLCAERRWARN(long updateCount, long rowCount)
updateCount
- rowCount
- private void writeSQLDIAGGRP(java.sql.SQLException nextException) throws DRDAProtocolException
DRDAProtocolException
private void writeSQLDIAGSTT() throws DRDAProtocolException
DRDAProtocolException
private void writeSQLDIAGCI(java.sql.SQLException nextException) throws DRDAProtocolException
DRDAProtocolException
private void writeSQLNUMROW(java.sql.SQLException nextException) throws DRDAProtocolException
DRDAProtocolException
private void writeSQLNUMGRP(java.sql.SQLException nextException) throws DRDAProtocolException
DRDAProtocolException
private void writeSQLDCROW(long rowNum, int sqlCode, java.lang.String sqlState, java.lang.String dbname, java.lang.String sqlerrmc) throws DRDAProtocolException
DRDAProtocolException
private void writeSQLDCGRP(long rowNum, int sqlCode, java.lang.String sqlState, java.lang.String dbname, java.lang.String sqlerrmc) throws DRDAProtocolException
DRDAProtocolException
private void writeSQLDIAGCN() throws DRDAProtocolException
DRDAProtocolException
private void writeSQLDARD(DRDAStatement stmt, boolean rtnOutput, java.sql.SQLException e) throws DRDAProtocolException, java.sql.SQLException
stmt
- prepared statementDRDAProtocolException
java.sql.SQLException
private void writeQRYDSC(DRDAStatement stmt, boolean FDODSConly) throws DRDAProtocolException, java.sql.SQLException
stmt
- DRDAStatement we are working onFDODSConly
- simply the FDODSC, without the wrap
Instance Variables
SQLDTAGRP - required
Only 84 columns can be sent in a single QRYDSC. If there are more columns
they must be sent in subsequent QRYDSC.
If the QRYDSC will not fit into the current block, as many columns as can
fit are sent and then the remaining are sent in the following blocks.DRDAProtocolException
java.sql.SQLException
private void writeSQLDTAGRP(DRDAStatement stmt, java.sql.ResultSetMetaData rsmeta, java.sql.ParameterMetaData pmeta, int colStart, int colEnd, boolean first) throws DRDAProtocolException, java.sql.SQLException
stmt
- drda statementrsmeta
- resultset meta datapmeta
- parameter meta data for CallableStatementcolStart
- starting column for group to sendcolEnd
- end column to sendfirst
- is this the first groupDRDAProtocolException
java.sql.SQLException
private void writeSQLDHROW(int holdability) throws DRDAProtocolException, java.sql.SQLException
holdability
- HOLD_CURSORS_OVER_COMMIT or CLOSE_CURSORS_AT_COMMITDRDAProtocolException
java.sql.SQLException
private void writeQRYDTA(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
stmt
- DRDA statement we are processingDRDAProtocolException
java.sql.SQLException
private boolean writeFDODTA(DRDAStatement stmt) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private java.lang.Object getObjectForWriteFdoca(java.sql.ResultSet rs, int index, int drdaType) throws java.sql.SQLException
Get a column value of the specified type from a ResultSet
, in
a form suitable for being writted by writeFdocaVal(int, java.lang.Object, int, int, int, boolean, org.apache.derby.impl.drda.DRDAStatement, boolean)
. For most
types, this means just calling ResultSet.getObject(int)
.
The only exception currently is the data types representing dates and
times, as they need to be fetched using the same
java.util.Calendar
as writeFdocaVal(int, java.lang.Object, int, int, int, boolean, org.apache.derby.impl.drda.DRDAStatement, boolean)
uses when writing
them (DERBY-4582).
Note: Changes made in this method should also be made in the
corresponding method for CallableStatement
:
getObjectForWriteFdoca(java.sql.CallableStatement, int, int)
.
rs
- the result set to fetch the object fromindex
- the column indexdrdaType
- the DRDA type of the object to fetchjava.sql.SQLException
getObjectForWriteFdoca(java.sql.CallableStatement, int, int)
private java.lang.Object getObjectForWriteFdoca(java.sql.CallableStatement cs, int index, int drdaType) throws java.sql.SQLException
Get the value of an output parameter of the specified type from a
CallableStatement
, in a form suitable for being writted by
writeFdocaVal(int, java.lang.Object, int, int, int, boolean, org.apache.derby.impl.drda.DRDAStatement, boolean)
. For most types, this means just calling
CallableStatement.getObject(int)
.
This method should behave like the corresponding method for
ResultSet
, and changes made to one of these methods, must be
reflected in the other method. See
getObjectForWriteFdoca(java.sql.ResultSet, int, int)
for details.
cs
- the callable statement to fetch the object fromindex
- the parameter indexdrdaType
- the DRDA type of the object to fetchjava.sql.SQLException
getObjectForWriteFdoca(java.sql.ResultSet, int, int)
private void splitQRYDTA(DRDAStatement stmt, int blksize) throws java.sql.SQLException, DRDAProtocolException
stmt
- DRDA statmentblksize
- size of query blockjava.sql.SQLException
DRDAProtocolException
private boolean processLeftoverQRYDTA(DRDAStatement stmt) throws java.sql.SQLException, DRDAProtocolException
java.sql.SQLException
DRDAProtocolException
private void doneData(DRDAStatement stmt, java.sql.ResultSet rs) throws DRDAProtocolException, java.sql.SQLException
stmt
- DRDA statementrs
- Result setDRDAProtocolException
java.sql.SQLException
private boolean positionCursor(DRDAStatement stmt, java.sql.ResultSet rs) throws java.sql.SQLException, DRDAProtocolException
stmt
- DRDA statementrs
- Result setjava.sql.SQLException
DRDAProtocolException
private void writeSQLDAGRP(java.sql.ResultSetMetaData rsmeta, java.sql.ParameterMetaData pmeta, int elemNum, boolean rtnOutput) throws DRDAProtocolException, java.sql.SQLException
rsmeta
- resultset meta datapmeta
- parameter meta dataelemNum
- column number we are returning (in case of result set), or,
parameter number (in case of parameter)rtnOutput
- whether this is for a result setDRDAProtocolException
java.sql.SQLException
private void writeVCMorVCS(java.lang.String s) throws DRDAProtocolException
s
- string to writeDRDAProtocolException
private void writeSQLUDTGRP(java.sql.ResultSetMetaData rsmeta, java.sql.ParameterMetaData pmeta, int jdbcElemNum, boolean rtnOutput) throws DRDAProtocolException, java.sql.SQLException
rsmeta
- resultset meta datapmeta
- parameter meta datajdbcElemNum
- column number we are returning (in case of result set), or,
parameter number (in case of parameter)rtnOutput
- whether this is for a result setDRDAProtocolException
java.sql.SQLException
private void writeSQLDOPTGRP(java.sql.ResultSetMetaData rsmeta, java.sql.ParameterMetaData pmeta, int jdbcElemNum, boolean rtnOutput) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
private void writeSQLDXGRP(java.sql.ResultSetMetaData rsmeta, java.sql.ParameterMetaData pmeta, int jdbcElemNum, boolean rtnOutput) throws DRDAProtocolException, java.sql.SQLException
DRDAProtocolException
java.sql.SQLException
protected void writeFdocaVal(int index, java.lang.Object val, int drdaType, int precision, int scale, boolean valNull, DRDAStatement stmt, boolean isParam) throws DRDAProtocolException, java.sql.SQLException
index
- Index of column being returnedval
- Value to write to clientdrdaType
- FD:OCA DRDA Type from FdocaConstantsprecision
- Precisionstmt
- Statement being processedisParam
- True when writing a value for a procedure parameterDRDAProtocolException
java.sql.SQLException
FdocaConstants
private void writeNullability(int drdaType, boolean valNull)
drdaType
- FDOCA typevalNull
- true if this is a null value. False otherwiseprivate java.lang.String formatDate(java.sql.Date date)
java.sql.Date
to a string with the format expected
by the client.date
- the date to formatDateTime.dateBytesToDate(byte[], int, java.util.Calendar, java.nio.charset.Charset)
private java.lang.String formatTime(java.sql.Time time)
java.sql.Time
to a string with the format expected
by the client.time
- the time to formatDateTime.timeBytesToTime(byte[], int, java.util.Calendar, java.nio.charset.Charset)
private java.lang.String formatTimestamp(java.sql.Timestamp ts)
java.sql.Timestamp
to a string with the format
expected by the client.ts
- the timestamp to formatDateTime.timestampBytesToTimestamp(byte[], int, java.util.Calendar, java.nio.charset.Charset, boolean)
private void padInt(char[] buf, int offset, int length, int value)
length
characters.buf
- the char arrayoffset
- where in the array to start inserting the valuelength
- the desired length of the inserted stringvalue
- the integer value to insertprivate void copyToRequired(int[] req)
req
- list of required codepointsprivate void removeFromRequired(int codePoint)
codePoint
- - code point to be removedprivate void checkRequired(int codePoint) throws DRDAProtocolException
codePoint
- code point for which list of code points is requiredDRDAProtocolException
private void tooMany(int codePoint) throws DRDAProtocolException
codePoint
- code point which has been duplicatedDRDAProtocolException
private void tooBig(int codePoint) throws DRDAProtocolException
codePoint
- code point with too big objectDRDAProtocolException
private void invalidClient(java.lang.String prdid) throws DRDAProtocolException
prdid
- product id that does not match DNCDRDAProtocolException
private void requiredValueNotFound(int codePoint) throws DRDAProtocolException
codePoint
- code point with invalid valueDRDAProtocolException
private void badObjectLength(int codePoint) throws DRDAProtocolException
codePoint
- code point with bad object lengthDRDAProtocolException
private void rdbNotFound(java.lang.String rdbnam) throws DRDAProtocolException
rdbnam
- name of databaseDRDAProtocolException
private void invalidValue(int codePoint) throws DRDAProtocolException
codePoint
- code point valueDRDAProtocolException
protected void invalidCodePoint(int codePoint) throws DRDAProtocolException
codePoint
- code point valueDRDAProtocolException
protected void codePointNotSupported(int codePoint) throws DRDAProtocolException
codePoint
- code point valueDRDAProtocolException
private void valueNotSupported(int codePoint) throws DRDAProtocolException
codePoint
- code point valueDRDAProtocolException
private void verifyRequiredObject(int codePoint, int reqCodePoint) throws DRDAProtocolException
codePoint
- code point we havereqCodePoint
- code point required at this timeDRDAProtocolException
private void verifyInOrderACCSEC_SECCHK(int codePoint, int reqCodePoint) throws DRDAProtocolException
codePoint
- code point we havereqCodePoint
- code point required at this timeDRDAProtocolException
private void rdbnamMismatch(int codePoint) throws DRDAProtocolException
codePoint
- codepoint where the mismatch occurredDRDAProtocolException
private void closeSession()
private void handleException(java.lang.Exception e)
private void sendProtocolException(DRDAProtocolException de)
de
- DRDAProtocolException
to be sentprivate void sendUnexpectedException(java.lang.Exception e)
e
- Exception to be sentprivate boolean closed()
private boolean getLogConnections()
private long getTimeSlice()
protected void trace(java.lang.String value)
value
- - value to print on consoleprivate void traceEXTDTARead(int drdaType, int index, EXTDTAReaderInputStream stream, boolean streamLOB, java.lang.String encoding)
drdaType
- the DRDA type of the EXTDTA valueindex
- the one-based parameter indexstream
- the stream being readstreamLOB
- whether or not the value is being streamed as the last
parameter value in the DRDA protocol flowencoding
- the encoding of the data, if anypublic static void showmem()
private java.lang.String convertToHexString(byte[] buf)
buf
- buffer to convertprivate void checkValidTypDefNam(java.lang.String typdefnam) throws DRDAProtocolException
typdefnam
- DRDAProtocolException
private void checkLength(int codepoint, int reqlen) throws DRDAProtocolException
codepoint
- codepoint we are checkingreqlen
- required lengthDRDAProtocolException
private boolean readBoolean(int codepoint) throws DRDAProtocolException
codepoint
- codePoint to be used in error reportingDRDAProtocolException
private void initializeDatabase(java.lang.String dbname)
dbname
- database name to initialize. If
dbnam is non null, add database to the current sessionprivate void setDatabase(int codePoint) throws DRDAProtocolException
codePoint
- codepoint we are processingDRDAProtocolException
private void writeENDUOWRM(int opType)
opType
- - operation type 1 - commit, 2 -rollbackvoid writeEXTDTA(DRDAStatement stmt) throws java.sql.SQLException, DRDAProtocolException
java.sql.SQLException
DRDAProtocolException
private void checkWarning(java.sql.Connection conn, java.sql.Statement stmt, java.sql.ResultSet rs, long updateCount, boolean alwaysSend, boolean sendWarn) throws DRDAProtocolException, java.sql.SQLException
conn
- connection to checkstmt
- statement to checkrs
- result set to checkupdateCount
- update count to include in SQLCARDalwaysSend
- whether always send SQLCARD regardless of
the existance of warningssendWarn
- whether to send any warnings or not.DRDAProtocolException
java.sql.SQLException
boolean hasSession()
long getBytesRead()
long getBytesWritten()
protected java.lang.String buildRuntimeInfo(java.lang.String indent, LocalizedResource localLangUtil)
private void finalizeChain() throws DRDAProtocolException
DRDAProtocolException
private int validateSecMecUSRSSBPWD() throws DRDAProtocolException
DRDAProtocolException
private static void closeStream(java.io.InputStream stream) throws java.sql.SQLException
stream
- the stream to close (possibly null
)java.sql.SQLException
- wrapped around an IOException
if closing
the stream failedprivate static java.io.InputStream convertAsByteArrayInputStream(EXTDTAReaderInputStream stream) throws java.io.IOException
java.io.IOException
private static void setAsCharacterStream(DRDAStatement stmt, int i, EXTDTAReaderInputStream extdtaStream, boolean streamLOB, java.lang.String encoding) throws java.io.IOException, java.sql.SQLException
stmt
- the DRDA statement to usei
- the one-based index of the parameterextdtaStream
- the EXTDTA stream to read data fromstreamLOB
- whether or not the stream content is streamed as the
last value in the DRDA protocol flowencoding
- the encoding of the EXTDTA streamjava.io.IOException
- if reading from the stream failsjava.sql.SQLException
- if setting the stream failsprivate static void setAsBinaryStream(DRDAStatement stmt, int index, EXTDTAReaderInputStream stream, boolean streamLOB) throws java.io.IOException, java.sql.SQLException
stmt
- the DRDA statement to useindex
- the one-based index of the parameterstream
- the EXTDTA stream to read data fromstreamLOB
- whether or not the stream content is streamed as the
last value in the DRDA protocol flowjava.io.IOException
- if reading from the stream failsjava.sql.SQLException
- if setting the stream failsprivate static ModuleFactory getMonitor()
private static java.lang.Object findService(java.lang.String factoryInterface, java.lang.String serviceName)
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.