Specifying a Connection Character Set
Go Up to Working with Databases
When a client application connects to a database, it may have its own character set requirements. The server providing database access to the client does not know about these requirements unless the client specifies them. The client application specifies its character set requirement using the SET NAMES
statement before it connects to the database.
SET NAMES
specifies the character set the server should use when translating data from the database to the client application. Similarly, when the client sends data to the database, the server translates the data from the client’s character set to the database’s default character set (or the character set for an individual column if it differs from the database’s default character set).
For example, the following statements specify that the client is using the DOS437 character set, then connect to the database:
EXEC SQL SET NAMES DOS437; EXEC SQL CONNECT 'europe.ib' USER 'JAMES' PASSWORD 'U4EEAH';
For more information about character sets, see the Data Definition Guide. For the complete syntax of SET NAMES
and CONNECT
, see the Language Reference Guide.