Bug #34034 | MySQL Connector/J 5.1.5 SELECT field AS myname not myname in ResultSetMetaData | ||
---|---|---|---|
Submitted: | 24 Jan 2008 13:47 | Modified: | 24 Jan 2008 13:58 |
Reporter: | Steve Markowski | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[24 Jan 2008 13:47]
Steve Markowski
[24 Jan 2008 13:58]
Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead. Thank you for your interest in MySQL. Explanation: Hi Steve and thanks for your report. I believe it is a duplicate of Bug#31499 (Bug#32504 and many more). The behavior you ask for isn't actually JDBC-compliant (which is why there was a change in behavior in 5.1). If you want the old, non-compliant behavior, you should add "useOldAliasMetadataBehavior=true" as a configuration parameter in your JDBC URL. Note: The JDBC-compliant way of getting the information you're asking for, i.e. the "alias" for the column is by calling ResultSetMetaData.getColumnLabel(), not getColumnName(). The reason that getColumnName() is _not_ supposed to return the alias, is because it is supposed to be possible for a consumer of this API to generate a DML statement based on the metadata present in the ResultSet and ResultSetMetaData, and thus getColumnName() should return the _physical_ column name, not the alias.