get column names method jav

Solutions on MaxInterview for get column names method jav by the best coders in the world

showing results for - "get column names method jav"
Erika
08 Mar 2016
1public static List<String> getColumnNames(){
2
3
4        List<String> columnList = new ArrayList<>();
5        try {
6            ResultSetMetaData rsMetaData = rs.getMetaData();
7            for (int colNum = 1; colNum < getColumnCount()  ; colNum++) {
8                columnList.add(rsMetaData.getColumnLabel(colNum));
9            }
10        } catch (SQLException e) {
11       System.out.println("ERROR WHILE GETTING COLUMN NAMES "+ e.getMessage());
12        }
13
14        return columnList;
15    }