IBM Support

SQL query on DB2 with XML data type results in Invalid operation error

Troubleshooting


Problem

A query of XML data types in IBM DB2 in Rational Integration Tester (RIT) of IBM Rational Test Workbench gives the error: "Invalid operation: No data is retrieved for OUT parameter".

Symptom

You see an error such as the following.

[jcc][t4][10132][10859][3.63.123] Invalid operation: No data is retrieved for OUT parameter. ERRORCODE=-4472, SQLSTATE=null

Cause

DB2 is returning an XML object that RIT incorrectly interprets.

Diagnosing The Problem

  1. Test the query in IBM Data Studio, to verify that the query itself is valid.

  2. Review the returned data. If the data looks like the following output, you might have an XML object.

    com.ibm.db2.jcc.am.oe@56805680

Resolving The Problem

WORKAROUND

Cast the data that the query returns to another type. The following example uses the XMLCAST option to cast the returned XML objects to the VARCHAR() data type.

Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.




SELECT XMLCAST (XMLQUERY('$d' PASSING  MY_DATA AS "d") AS VARCHAR (20))


  FROM MY_TABLE

[{"Product":{"code":"SSBLQQ","label":"IBM Rational Test Workbench"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Rational Integration Tester","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
29 September 2018

UID

swg21618154