When code page conversion occurs
Code page conversion can occur in the following situations:
- When a client or application accessing a database is running in
a code page that is different from the code page of the statement
being invoked: You can minimize or eliminate client/server character conversion in some situations. For example, you could:
- Create a database on Windows using code page 850 to match a Windows client application environment that predominately uses code page 850.
- Create a database on AIX® using code page 850 to match a client application environment that predominately uses code page 850.
- Avoid specifying the CCSID option when creating tables and the PARAMETER CCSID option when creating routines.
- When a client or application importing a PC/IXF file runs in a
code page that is different from the file being imported.
This data conversion will occur on the IBM® data server client machine before the client accesses the database server. Additional data conversion might take place if the application is running in a code page that is different from the code page of the database (as stated in the previous point).
Data conversion, if any, also depends on how the import utility was called.
- When Db2 Connect is used to access data on a host, z/OS®, or System i server. In this case, the data receiver converts the character data. For example, data that is sent to Db2® for z/OS is converted to the appropriate coded character set identifier (CCSID) by Db2 for z/OS. The data sent back to the Db2 Connect machine from Db2 for z/OS is converted by Db2 Connect.
Character conversion will not occur for:
- File names. You should either use the ASCII invariant set for file names or provide the file name in the hexadecimal values that are physically stored in the file system. Note that if you include a file name as part of an SQL statement, it gets converted as part of the statement conversion.
- Data that
is targeted for or comes from a column assigned the FOR BIT DATA attribute, or data used in an
SQL operation whose result is FOR BIT, binary, or BLOB data. In these cases, the data is
treated as a byte stream and no conversion occurs. Note: A literal inserted into a column defined as FOR BIT DATA could be converted if that literal was part of an SQL statement that was converted.
- A Db2 product or platform that does not support, or that does not have support installed, for the required combination of code pages. In this case, an SQLCODE -332 (SQLSTATE 57017) is returned when you try to run your application.