28

What is the difference between ResultSetMetaData.getColumnLabel and ResultSetMetaData.getColumnName?

Label: Gets the designated column's suggested title for use in printouts and displays.

Name: Get the designated column's name.

Does anyone know how Label is determined?

Marmite Bomber
  • 19,886
  • 4
  • 26
  • 53
sova
  • 5,468
  • 10
  • 40
  • 48

1 Answers1

43
String getColumnLabel(int column) throws SQLException;  

If a SQL AS is not specified, the value returned from getColumnLabel will be the same as the value returned by the getColumnName method.

Example:

select id as user_no from users
  • getColumnLabel would return 'user_no'
  • getColumnName would return 'id'
Morgoth
  • 4,935
  • 8
  • 40
  • 66
stacker
  • 68,052
  • 28
  • 140
  • 210