DB2 CHAR to VARCHAR conversion error

Symptom

Connecting to a DB2 Version 10 database using the Rocket Shadow ODBC 7.3 driver and getting the following error when using a Remote Procedure Call (RPC) to execute a stored procedure:

SQLCode = -1
SQLErrText = SQLSTATE = S1000 [DataDirect][ODBC Shadow driver][DB2] Output parameter 9 returned data type 0x01C1 incompatible with bound data type 0x01C5

This error didn't occur with the Rocket Shadow ODBC 7.2 driver.

Environment

  • PowerBuilder

  • IBM DB2 Version 10

Cause

The Rocket Shadow 7.3 driver enforces a stricter type mapping than IBM does. DB2 allows a CHAR to VARCHAR type mapping.  However the Rocket Shadow 7.3 driver does not.  

It should also be noted that the Rocket JDBC drivers do an automatic rebind for RPCs whereas the ODBC drivers do not.

Solution

Use the database parameter RPCRebind=1.