public static List < String > getFieldNames ( ResultSetMetaData resultSetMetaData ) throws SQLException { List < String > columnNames = new ArrayList <> ( ) ; int cols = resultSetMetaData . getColumnCount ( ) ; for ( int i = 1 ; i <= cols ; i ++ ) { columnNames . add ( resultSetMetaData . getColumnName ( i ) ) ; } return columnNames ; }
Fetch the name of columns