In Connector/J 5.0.x and earlier, the alias for a table in
a SELECT statement is
returned when accessing the result set metadata using
ResultSetMetaData.getColumnName().
This behavior however is not JDBC compliant, and in
Connector/J 5.1 this behavior was changed so that the
original table name, rather than the alias, is returned.
The JDBC-compliant behavior is designed to let API users
reconstruct the DML statement based on the metadata within
ResultSet and
ResultSetMetaData.
You can get the alias for a column in a result set by
calling
ResultSetMetaData.getColumnLabel().
To use the old noncompliant behavior with
ResultSetMetaData.getColumnName(),
use the useOldAliasMetadataBehavior
option and set the value to true.
In Connector/J 5.0.x, the default value of
useOldAliasMetadataBehavior was
true, but in Connector/J 5.1 this was
changed to a default value of false.

User Comments
Add your own comment.