This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
With Netbeans 6.1dev you are shipping the 5.1.5 version of mysql-connector jdbc driver. But there is a problem with this driver with Netbeans: the alias in the SELECT clause of a query are not working. For example: SELECT atributo AS atrib FROM confflota it should return (with 5.0.7 and 5.0.8 in fact it does): --------- | atrib | --------- | xxxxx | | xxxxx | | ..... | --------- but this is the result: ------------ | atributo | ------------ | xxxxxxxx | | xxxxxxxx | | ........ | ------------ That is clearly wrong. This makes that every query that uses alias cannot work well with the ResultSet. This is also affecting other components (visual web, ...).
Well, this surprised me, but see this bug report: http://bugs.mysql.com/bug.php?id=34034 <quote> 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. </quote> I will fix the code to do things in the compliant way, and get the column label versus the column name, when displaying results. If visualweb is using getColumnName(), then this should be changed as well. I'll open an associated bug against visualweb.
Since a reasonable workaround exists (change your URL to include the property "useOldAliasMetadataBehavior=true") I am downgrading this to a P3.
Logged issue 129330 for visualweb to get us to start using getColumnLabel() instead of getColumnName()
http://hg.netbeans.org/main?cmd=changeset;node=dd399e6aa6ea
Since the label is used everywhere, the name property of ColumnDef is not used now, just making the class more complex. Would have been better to just pass rsmd.getColumnLabel() to ColumnDef's constructor instead of introducing a new property.
Yes, fair enough. Re-opening as a P4
Applies to code that was obsoleted by dataview, so not applicable anymore.