java.sql.SQLException: Column 'name' not found.
The query was perfectly running from the command prompt. Developers using Windows and Ubuntu did not have the same issue so I decided to upgrade to latest version both MySQL and the JDBC connector. The issue did not go away.
Problem explainedThe below will fail ...
SELECT DISTINCT c.name AS `Client Name`, ...But this will work:
SELECT DISTINCT c.name, ...Whether we need the aliases in the query is a good point. Especially for internationalization this is a bad practice but I needed to be sure my MAC could support this :-)
The SolutionUse a flag in the connection string:
SELECT DISTINCT c.name, ...jdbc.url=jdbc:mysql://localhost:3306/nestorurquiza?useOldAliasMetadataBehavior=true
From MySQL Reference Manual:
"Should the driver use the legacy behavior for "AS" clauses on columns and tables, and only return aliases (if any) for ResultSetMetaData.getColumnName() or ResultSetMetaData.getTableName() rather than the original column/table name? In 5.0.x, the default value was true."