get column names jdbc

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

showing results for - "get column names jdbc"
Alessia
06 Jul 2019
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    }
similar questions
get column count jdbc