GetColumnLabel vs getColumnName

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

Label: Returns the title of the header assigned to the column for use in printouts and displays.

Name: Get the name of the assigned column.

Does anyone know how Label is defined?

+22
java resultset
Nov 24 '10 at 20:20
source share
1 answer
String getColumnLabel(int column) throws SQLException; 

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

Example:

 select id as user_no from users 
  • getColumnLabel will return 'user_no'
  • getColumnName will return 'id'
+37
Nov 24 '10 at 20:30
source share



All Articles