티스토리 뷰

공부

[Java] MySQL select value

승가비 2022. 1. 10. 20:58
728x90
 ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
 ResultSetMetaData rsmd = rs.getMetaData();
 String name = rsmd.getColumnName(1);

https://stackoverflow.com/questions/696782/retrieve-column-names-from-java-sql-resultset

 

Retrieve column names from java.sql.ResultSet

With java.sql.ResultSet is there a way to get a column's name as a String by using the column's index? I had a look through the API doc but I can't find anything.

stackoverflow.com

 

728x90

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

[Mac] MySQL (brew install mysql; mysql.server start)  (0) 2022.01.10
[Java] MySQL if check exists table  (0) 2022.01.10
[Python] if isinstance(object, [list, dict])  (0) 2022.01.10
[MySQL] Types  (0) 2022.01.10
[Java] JSON Object  (0) 2022.01.10
댓글