Here you can find the source of getNumberColumns(ResultSet rs)
public static int getNumberColumns(ResultSet rs) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.*; public class Main { public static int getNumberColumns(ResultSet rs) throws SQLException { ResultSetMetaData md = rs.getMetaData(); int nCols = md.getColumnCount(); return (nCols); }//from ww w .ja v a 2 s .c om }