Java SQL ResultSet Print printItems(ResultSet rs)

Here you can find the source of printItems(ResultSet rs)

Description

print Items

License

Open Source License

Declaration

public static void printItems(ResultSet rs) 

Method Source Code


//package com.java2s;
/*//from ww  w  .j av  a  2  s .  c  om
 * Copyright 2000-2011 Enonic AS
 * http://www.enonic.com/license
 */

import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    public static void printItems(ResultSet rs) {
        try {
            int columns = rs.getMetaData().getColumnCount();
            for (int i = 0; i < columns; i++) {
                System.out.println(i + ": " + rs.getObject(i + 1));
            }
        } catch (SQLException sqle) {
            sqle.printStackTrace();
        }
    }
}

Related

  1. print(ResultSet rs, PrintStream out)
  2. printCols(final ResultSetMetaData paymentTableResultSetMetaData, final String logging_prefix)
  3. printColTypes(ResultSetMetaData rsmd)
  4. printHeader(PrintWriter pw, ResultSet rs)
  5. printHeaders(ResultSetMetaData rsmd, PrintStream out)
  6. printoutDB(ResultSet rs)
  7. printRecord(PrintWriter pw, ResultSet rs)
  8. printResult(ResultSet rs)
  9. printResults(final ResultSet results)