Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

java - getColumnLabel vs. getColumnName

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
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'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...