Java SQL ResultSet Print printResult(ResultSet rs)

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

Description

print Result

License

Open Source License

Declaration

public static void printResult(ResultSet rs) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

import com.mysql.jdbc.ResultSetMetaData;

public class Main {
    public static void printResult(ResultSet rs) throws SQLException {
        ResultSetMetaData rsmd = (ResultSetMetaData) rs.getMetaData();
        int colNum = rsmd.getColumnCount();

        while (rs.next()) {
            for (int i = 0; i < colNum; i++)
                System.out.printf(rs.getString(i + 1) + " ");
            System.out.println();
        }//from   www .  j  a va2  s .  c om
    }
}

Related

  1. printHeader(PrintWriter pw, ResultSet rs)
  2. printHeaders(ResultSetMetaData rsmd, PrintStream out)
  3. printItems(ResultSet rs)
  4. printoutDB(ResultSet rs)
  5. printRecord(PrintWriter pw, ResultSet rs)
  6. printResults(final ResultSet results)
  7. printResults(ResultSet rst)
  8. printResultSet(List> rows, List colNames)
  9. printResultSet(ResultSet rs)