Here you can find the source of hasColumn(ResultSet rs, String columnName)
public static boolean hasColumn(ResultSet rs, String columnName) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; public class Main { public static boolean hasColumn(ResultSet rs, String columnName) throws SQLException { ResultSetMetaData rsmd = rs.getMetaData(); int columns = rsmd.getColumnCount(); for (int x = 1; x <= columns; x++) { if (columnName.equals(rsmd.getColumnName(x))) { return true; }/*from w w w .java 2 s. co m*/ } return false; } }