Kbase 18811: Apptivity Generated SQL Qualifies Column Name w/ Table Name
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  05/05/1999 |
|
Apptivity Developer and Runtime 2.x, 3.x
SUMMARY:
For inserting or updating a row in a database, Apptivity generates SQL
code in which column names are qualified with table names -- in the form:
<table-name>.<column-identifier>
If the ODBC or JDBC driver being used does not expect column names to
be qualified with table names, this may generate errors, and prevent
the updates from succeeding.
EXPLANATION:
Apptivity Developer generates SQL in which column names are qualified
with table names, e.g.:
INSERT INTO DEMO_PRODUCT
(DEMO_PRODUCT.PRICE, DEMO_PRODUCT.PRODUCT, DEMO_PRODUCT.PRODUCT_NAME)
VALUES(? ,100 ,'Easysoft JDBC-ODBC Bridge');
Some drivers will reject a statement in this form, expecting to see
only the unqualified column names, for example:
INSERT INTO DEMO_PRODUCT
(PRICE, PRODUCT, PRODUCT_NAME )
VALUES(? ,100,'Easysoft JDBC-ODBC Bridge');
When such a driver executes a statement in which column names are
qualified with table names, it will generate an error message such as
"Column cannot be updated - original value restored" and the data will
not be written to the database.
SOLUTION:
To get around this, use column aliases in the SQL query, for example:
SELECT DEMO_PRODUCT.PRICE AS PRICE, DEMO_PRODUCT.PRODUCT AS PRODUCT,
DEMO_PRODUCT.PRODUCT_NAME AS PRODUCT_NAME FROM DEMO_PRODUCT;
The aliased columns will then appear in a form acceptable to the
driver, for example:
INSERT INTO DEMO_PRODUCT
(PRICE, PRODUCT, PRODUCT_NAME )
VALUES(? ,100,'Easysoft JDBC-ODBC Bridge');
References To Written Documentation:
Progress Knowledge Base Solution 17772, "Using Column Alias in Apptivity"