Column aliasing in SELECT statements doesn't work with SQuirrel SQL + Firebird

笑着哭i 提交于 2019-12-02 22:27:44

The problem is due to confusion in the JDBC specs (at least historically) and a change in Jaybird with regard to what it reports as columnNames and columnLabels in the resultset metadata. As far as I am aware in JDBC 2.0 and earlier, the distinction between columnName and columnLabel was not well defined, so in almost all cases getColumnName() returned the same value as getColumnLabel() (ie the AS alias if specified).

With JDBC 3.0 a sharper distinction was made: the columnName was to be the name of the underlying column in a table (if any), the columnLabel is the AS-alias if specified and otherwise the columnName. Jaybird 2.1.6 and earlier used to return the same value for getColumnLabel() and getColumnName() (ie the columnLabel), this was changed in Jaybird 2.2.

Apparently Squirrel defaults to the non-JDBC compliant option of columnName, instead of columnLabel. As you already found out: there is an option to get it to use the columnLabel instead. The other option you have is to use Jaybird 2.2.1 or higher and add the connection property columnLabelForName=true.

In Squirrel this needs to be set up on:

File > Global Preferences > Data Type Controls > Check: Use column labels instead of column names in result headers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!