Java examples for java.sql:ResultSetMetaData
print Result Set Header via ResultSetMetaData
//package com.java2s; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; public class Main { public static int printResultSetHeader(ResultSet rs) throws SQLException { return printResultSetHeader(rs.getMetaData()); }//from w w w .j a v a2 s .co m public static int printResultSetHeader(ResultSetMetaData metaData) throws SQLException { int numColumns = metaData.getColumnCount(); for (int i = 1; i <= numColumns; i++) System.out.print(metaData.getColumnLabel(i) + "\t"); System.out.println(""); return numColumns; } }