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.
See issue 129271 - the new MySQL 5.1.5 driver we include is now compliant in that it returns the actual column name, not the column *label*, when you call ResultSetMetaData.getColumnName(). The problem is that when the query includes an alias, e.g. "SELECT lastname as last from person" with 5.1.5 you will get "lastname" instead of "last" when you call getColumnName(). To fix this the URL should use "useOldAliasMetadataBehavior=true". Then, in our code, we need to change things as such: if you want the *actual* column name use getColumnName(), but in use cases where you want to show the label/alias, and not the actual name, use getColumnLabel().
davidvc are you suggesting to replace getColumnName() with getColumnLabel() or just for MySQL?
Yes, use getColumnLabel() instead of getColumnName() unless you want the actual name (e.g. for managing metadata). I suspect in most if not all cases we're getting the name so we can display it to the user, in which case what we want is the label, not the name. This is for all databases, not just MySQL.
I'll make a local change and try this out. If no issues then I'll integrate into 6.1
This might be a risky fix for 6.1 - might break existing applications ? Since 129271 is marked for future, is it ok for this to be fixed for the next release?
It's your call - I don't know the impact as well as you. Not essential to fix, it is a P3 after all. The workaround is to add the "useOldAliasMetadataBehavior=true" property to the URL when using the new driver.
since there's a workaround and to play it safe, I'll set the target milestone to future
Replacing getColunnName() with getColumnLabel() , DnD database table and CRUD applications work for MySQL and other databases: Oracle, DB2, Firebird, Postgres, MSSSQL, Derby
http://hg.netbeans.org/main/rev/ad2b12041257
*** Issue 132647 has been marked as a duplicate of this issue. ***
I made some mistakes and corrected some or all of them. http://hg.netbeans.org/main/rev/c35f0e22ee80
Verified with trunk build 080422. Do push into patch1 branch.
2 more change sets 88e3245243c7 a29eee5900b0 also these changesets would need to be transplanted to the patch c35f0e22ee80 ad2b12041257
*** Issue 133672 has been marked as a duplicate of this issue. ***
Added setColumnLabel So in addition to the changesets in the previous comment also need to include 8bf6efc2b437 b449dff4241c
Issue '129330' Integrated in NB_Trunk_Production #154 : http://hg.netbeans.org/main/rev/8bf6efc2b437, with comment: #129330 Code displaying column names should use getColumnLabel() instead of getColumnName(); need to add setColumnLabel
backported into release61_fixes branch changeset: 77531:001be38e24d4