get column count in java

Solutions on MaxInterview for get column count in java by the best coders in the world

showing results for - "get column count in java"
Ella
21 Aug 2016
1/**
2     * Get the column count
3     * @return count of column the result set have
4     */
5    public static int getColumnCount(){
6
7        int columnCount = 0;
8
9        try {
10            ResultSetMetaData rsMetaData = rs.getMetaData();
11            columnCount = rsMetaData.getColumnCount();
12        } catch (SQLException e) {
13            System.out.println("ERROW WHILE GETTING COLUMN COUNT " +e.getMessage());
14        }
15        return columnCount;
16    }