'com.ibm.db2.jcc.b.SqlException: "myschema.MYTABLE" is an undefined name' occurs when executing an SQL statement from within WebSphere Application Server V5.0
 Technote (troubleshooting)
 
Problem(Abstract)
The following exception occurs when using WebSphere® Application Server V5.0 configured with a DB2® V8.2 Universal JDBC driver Type 4:

[9/1/05 10:34:40:107 CDT] 0000003f SystemErr R
com.ibm.db2.jcc.b.SqlException: "myschema.MYTABLE" is an undefined
name.
at com.ibm.db2.jcc.b.id.e(id.java:1640)
at com.ibm.db2.jcc.b.id.a(id.java:1229)
at com.ibm.db2.jcc.c.fb.h(fb.java:149)
at com.ibm.db2.jcc.c.fb.a(fb.java:43)
...
---- Begin backtrace for Nested Throwables
com.ibm.db2.jcc.b.SqlException: An error occurred during implicit system
action type "2". Information returned for the error includes SQLCODE
"-204", SQLSTATE "42704" and message tokens "myschema.MYTABLE".
at com.ibm.db2.jcc.b.id.e(id.java:1640)
at com.ibm.db2.jcc.b.id.a(id.java:1250)

The datasource is configured with a custom property of:
name = currentSchema
value = myschema
 
Cause
The cause of the problem is a difference in the way that DB2 handles a datasource's custom properties versus hard coding the schema name in the SQL statement.
 
Resolving the problem
When the schema name is placed in the SQL statement, DB2 will parse the full statement and translate the schema. The capitalization does not matter. For example:

select count(*) from myschema.MYTABLE

However, in the error scenario, the "currentSchema" custom property is set on the datasource used to get the connection and this SQL statement is used:

select count(*) from MYTABLE

The schema name is not placed in the SQL statement which means that it is taken from the "currentSchema" custom property. This custom property is case sensitive which means that the value must be in capital letters:

name = currentSchema
value = MYSCHEMA
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > DB Connections/Connection Pooling
Operating system(s): Windows
Software version: 5.1.1.6
Software edition:
Reference #: 1220382
IBM Group: Software Group
Modified date: Oct 20, 2005