Java SQL ResultSet Print printoutDB(ResultSet rs)

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

Description

printout DB

License

Apache License

Declaration

public static void printoutDB(ResultSet rs) throws SQLException 

Method Source Code

//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 void printoutDB(ResultSet rs) throws SQLException {
        ResultSetMetaData meta = rs.getMetaData();
        int cols = meta.getColumnCount() + 1;
        while (rs.next()) {
            System.out.println("=== ROW START ===");
            for (int i = 1; i < cols; i++) {
                System.out.println(meta.getColumnName(i) + ": " + rs.getString(i));
            }/*from  w w  w .j a  v a2  s .  c  o m*/
            System.out.println("=== ROW END ===");
        }
    }
}

Related

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