Article #29866: problems with dbExpress connecting to DB2. Get error: SQL0204N "tablename" is an undefined name. SQLSTATE-42704
Problem:
When using dbExpress and accessing a table on a DB2 database, if I have a select statement in the CommandText property of a TSQLDataSet in the form: select * from employee
the following error is raised when attempting to apply updates: Project TestDBX.exe raised exception class EDatabaseError with message '[IBM][CLI Driver][DB2/NT] SQL0204N "employee" is an undefined name. SQLSTATE-42704
This error is raised even after verifying that employee is a valid table in the database.
Solution:
The way dbExpress handles the SQL statement requires the Table Name and the Schema Name to be in Upper Case letters. In the CommandText property, change the sql statement to: select * from EMPLOYEE
and the error listed above should go away.