IBM Support

DB2 SQL Query SELECT AS gives "SQL errorcode=-4460"

Troubleshooting


Problem

SQL queries fail with "Unknown column name" error in IBM Rational Integration Tester (RIT) of IBM Rational Test Workbench (RTW).

Symptom

When running a SELECT AS in the SQL Query test action you see an error such as the following:

>[jcc][10150][10300][4.14.88] Invalid parameter: Unknown column name <column name>. ERRORCODE=-4460,SQLSTATE=null"

Cause

Newer DB2 JDBC drivers exhibit different behaviour when returning column names using the "AS" clause.
See this Information Center section:

ResultSetMetaData returns different values for the IBM Data Server Driver for JDBC and SQLJ Version 4.0

Resolving The Problem

There are two solutions to this.

  • Modify the physical database connection specification to use the old version of semantics by appending
    the useJDBC4ColumnNameAndLabelSemantics parameter:

    jdbc:db2://localhost:50000/SAMPLE:useJDBC4ColumnNameAndLabelSemantics=2;

  • Modify the query to use an expression in the column name:

    select <EXPRESSION> as MY_NAME from TABLE where ID=1

    For example, concatenate a blank with the column name:

    select COLUMN_NAME || '' as MY_NAME from TABLE where ID=1

[{"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":"PF022","label":"OS X"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.0;8.5","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
29 September 2018

UID

swg21635332