About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Last updated: Nov 26, 2024
If you run queries that compare string data types against Db2® remote databases, which use the Db2 connection type that is not in VARCHAR2 compatibility mode, these queries might return incorrect results.
Symptoms
You run some queries that compare string data types (CHAR or VARCHAR) against Db2 remote databases that are not in VARCHAR2 compatibility mode and use the Db2 connection type. You get results that are different from what you get in a local database because the queries pushdown and follow the remote Db2 comparison rules.
For example,
select col_char from testable1 union select col_varchar from testable2;
select col_char from testable1 except select col_varchar from testable2;
select col_char from testable1 intersect select col_varchar from testable2;
You can check the configuration of the remote Db2 database by running the
command. In the following example, the database is not in VARCHAR2 compatibility
mode.db2 get db
cfg
$ db2 get db cfg for testdb |grep "Varchar2 compatibility" Varchar2 compatibility = OFF
Resolving the problem
To work around this issue, modify the collating sequence server option.
- Run the following statement to identify the internal Connection ID (
) for your data source.CID
select * from DVSYS.LISTRDBC;
This query lists all of the connections in the cluster. Find the row in the output for the connection or connections that you want to change.
- Run the following command to modify the COLLATING_SEQUENCE parameter of
this connection to
for each connection that you want to change.'I'
ALTER SERVER QPLEX OPTIONS (add <CID>@collating_sequence 'I');
For example,ALTER SERVER QPLEX OPTIONS (add DB210000@collating_sequence 'I');