Skip to main content

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


Technote (troubleshooting)


Problem(Abstract)

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


Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

Rational Test Workbench

Rational Integration Tester


Software version:
8.0


Operating system(s):
AIX, Linux, Solaris, Windows


Reference #:
1618154


Modified date:
2012-12-21

Translate my page

Content navigation