티스토리 뷰

공부

[Java] MySQL get column name

승가비 2022. 1. 16. 20:04
728x90
ResultSetMetaData metaData = resultSet.getMetaData();
int count = metaData.getColumnCount(); //number of column
String columnName[] = new String[count];

for (int i = 1; i <= count; i++)
{
   columnName[i-1] = metaData.getColumnLabel(i);
   System.out.println(columnName[i-1]);
}

https://stackoverflow.com/questions/19094999/java-how-to-get-column-name-on-result-set

 

Java - How to get Column name on Result Set

Hello I'm trying to make an error when there is no matched student... and it will display like this No matching records found and I want the column name still the same but still not figuring it out...

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[IntelliJ] test coverage 80%  (0) 2022.01.16
[Kafka] configuration partition rebalancing  (0) 2022.01.16
[Spring] Profile  (0) 2022.01.14
[Java] kafka create topic  (0) 2022.01.14
[Java] StringEscapeUtils.escapeJava(str);  (0) 2022.01.14
댓글