Here you can find the source of printoutDB(ResultSet rs)
public static void printoutDB(ResultSet rs) 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 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 ==="); } } }