db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dyre.Tjeldv...@Sun.COM
Subject Re: DRDA confusion
Date Thu, 01 Nov 2007 17:11:47 GMT
Knut Anders Hatlen <Knut.Hatlen@Sun.COM> writes:

>> But I still don't understand where the DRDA spec defines the two
>> formats that can be used... Does anyone have the chapter and verse
>> which descibes this? 
> I don't know where it is defined, or whether it's defined at all. But as
> I read the code, the byte sequences should be read like this:
>>> (0x00, len, ... bytes ..., 0xff) 
> First byte is a null indicator for a mixed-byte character string. Since
> it is different from 0xff (which is the null-marker), it is followed by
> the string length in bytes and the string encoded in a mixed-byte format
> (UTF-8, I would guess, but it is negotiable, see for instance setting of
> ccsid[SDM]BCEncoding in DRDAConnThread.parseTYPDEFOVR()). The last byte
> (0xff) is a null indicator for a single-byte character string. Nothing
> follows it since it marks that the single-byte character string is null.
>>> (0xff, 0x00, len, ... bytes ...)
> First byte indicates that the mixed-byte character string is null,
> second byte indicates that the single-byte character string is not
> null. Then follows length in bytes, and the string encoded as
> single-byte per character.
> Only one of the null indicators can be different from 0xff (otherwise
> the string would be encoded twice). (0xff, 0xff) indicates that the
> string is null.

Thanks for the explanation :) But what about the following code from
	 * 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.
	 * @param s	string to write
	 * @exception DRDAProtocolException

	private void writeVCMorVCS(String s)
		throws DRDAProtocolException
		//Write only VCM and 0 length for VCS

		if (s == null)

		// VCM
		// VCS

According to the comment this uses the variable character mixed byte
format. Should it not have used 0xff, 0xff for null also? And why does
it add 0x00, 0x00 after the string? Or is the format different for


View raw message