The processing of a successful CONNECT statement returns information in the SQLCA that is important when the possibility exists for applications to process data in an environment that includes a Japanese or Traditional-Chinese EUC code page at the client or server. The SQLERRD(1) field gives the maximum expansion of a mixed character string when converted from the application code page to the database code page. The SQLERRD(2) field gives the maximum expansion of a mixed character string when converted from the database code page to the application code page. The value is positive if expansion could occur and negative if contraction could occur. If the value is negative, the value is always -1 since the worst case is that no contraction occurs and the full length of the string is required after conversion. Positive values may be as large as 2, meaning that in the worst case, double the string length may be required for the character string after conversion.
The code page of the application server and the application client are also available in the SQLERRMC field of the SQLCA.
The data types determined for untyped parameter markers (as described in Table 28) are not changed in an environment that includes Japanese or Traditional-Chinese EUC. As a result, it may be necessary in some cases to use typed parameter markers to provide sufficient length for mixed character strings in eucJP or eucTW. For example, consider an insert to a CHAR(10) column. Preparing the statement:
INSERT INTO T1 (CH10) VALUES (?)
would result in a data type of CHAR(10) for the parameter marker. If the client was eucJP or eucTW, more than 10 bytes may be required to represent the string to be inserted but the same string in the DBCS code page of the database is not more than 10 bytes. In this case, the statement to prepare should include a typed parameter marker with a length greater than 10. Thus, preparing the statement:
INSERT INTO T1 (CH10) VALUES (CAST(? AS VARCHAR(20))
would result in a data type of VARCHAR(20) for the parameter marker.