Consultor Eletrônico



Kbase P128820: ODBC error -219901 prevents connection to Chinese database (CP950)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   06/02/2008
Status: Unverified

FACT(s) (Environment):

Progress 9.1x
UNIX

SYMPTOM(s):

Attempting to connect to database with code-page CP950

ODBC connection fails with error -219901

Database running on a UNIX system

UNIX server locale set to Chinese

Client running on UNIX

UNIX client locale set to Western European

Setting SQL_CLIENT_ACCESS to CP950 results in an error:

Native error code: 60004
Failed to get SQL_CLIENT_CHARSET name, no information supplied!

ODBC connection from UNIX client to database with a single-byte code-page succeeds

JDBC connection from UNIX to database running in CP950 code-page succeeds

ODBC connection from Windows to database running in CP950 code-page fails

ODBC connection from Windows to database running in CP950 code-page succeeds after Windows locale settings are changed to Chinese

CAUSE:

Chinese character set was not installed on the UNIX client machine. As per the Progress ODBC Driver Guide:

The Progress SQL-92 ODBC driver is capable of using double-byte character sets. The driver normally uses the character set defined by the default locale "C" unless explicitly pointed to another character set. The default locale "C" corresponds to the 7-bit ASCII character set in which only characters from ISO 8859-1 are valid.

FIX:

Use the following procedure to set the locale to a different character set:

1) Add the following line at the very beginning of applications that use double-byte character sets:

setLocale (LC_ALL, "");

This is a standard UNIX function. It selects the character set indicated by the environment variable LANG as the one to be used by X/Open compliant character handling functions. If this line is not present, or if LANG is either not set or is set to NULL, the default locale "C" is used.

2) Set the LANG environment variable to the appropriate character set. The UNIX command locale -a can be used to display all supported character sets on your system.