Created On:  2010-04-30

Problem:

When Using OpenESQL and explicitly qualifying the ODBC table causes SQLCODE=-206 at execution, is there an equivalent to the DB2(QUALIFIER=xxx) directive when using SQL(DBMAN=ODBC)?

The following code snippet causing SQLCODE -206 during execution:$SET SQL(DBMAN=ODBC)
EXEC SQL SELECT
TABLE1.COL1
INTO :WS-COL1
FROM DB2PROD.TABLE1
END-EXEC

Resolution:

If all applications use the same schema, set the CURRENTSCHEMA CLI parameter in the DB2 ODBC Driver. If they do not use the same schema, you can add a EXEC SQL statement to set the CURRENT SCHEMA in the application itself.

For example:
EXEC SQL SET CURRENT SCHEMA = 'DB2PROD' END-EXEC.

If compilation error occurs, set the CURRENT schema as a dynamic SQL statement move "SET CURRENT SCHEMA = 'DB2PROD' " to stmtbuf
EXEC SQL
EXECUTE IMMEDIATE :stmtbuf
END-EXEC
Incident #2449126