Here you can find the source of getAllColumnNames(ResultSet rs)
private static List<String> getAllColumnNames(ResultSet rs) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Main { private static List<String> getAllColumnNames(ResultSet rs) throws SQLException { List<String> columnNames = new ArrayList<String>(); if (null != rs) { for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) { columnNames.add(rs.getMetaData().getColumnName(i + 1)); }/*from w ww. j a va 2 s . c o m*/ } return columnNames; } }