Bug #33561 SQL JSTL select doesn't work with alias field
Submitted: 28 Dec 2007 22:52 Modified: 31 Dec 2007 13:09
Reporter: Zoltán Gere Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.5 OS:Any (SunOS, Windows XP)
Assigned to: CPU Architecture:Any
Tags: SQL JSTL select doesn't work with alias field

[28 Dec 2007 22:52] Zoltán Gere
Description:
I tested my JSP page with mysql-connector-java-5.0.4-bin.jar the next select:
<sql:query var="xy" dataSource="jdbc/xxxx" >
     select a.ingatlan_id, tulvisz.id as tulvisz_id
...
...
</sql:query>

It worked fine and I upgraded the connector to mysql-connector-java-5.1.5-bin.jar. And now the select doesn't give value. TULVISZ_ID field is empty. 

How to repeat:
I have tried on my service provider:
Application server Tomcat - SunOS 
Database server: 5.0.32-Debian_7etch3
mysql-connector-java-5.1.5-bin.jar the experience is same TULVISZ_ID field is empty
[29 Dec 2007 0:16] Mark Matthews
For many sane reasons, the JDBC experts' group clarified the meaning of "column name" to mean original column name, not the alias (which can be retrieved via the getColumnLabel() method of ResultSetMetaData), therefore our JDBC driver uses this definition when mapping from "name" to column ordinal in ResultSet.get*(String).

You can revert to the old behavior by setting the configuration property "useOldAliasMetadataBehavior" to "true" with our JDBC driver, but applications (and frameworks) really should be changed to support the behavior.
[29 Dec 2007 0:19] Mark Matthews
MC, Could we get a mention of this in the "Upgrading" section?
[31 Dec 2007 13:09] MC Brown
There already was a section on this in the manual, but I've made a couple of tweaks and re-ordered this section so that hopefully this information will be clearer.