Here you can find the source of dumpResultSet(ResultSet rs)
public static String dumpResultSet(ResultSet rs) throws SQLException
//package com.java2s; // This package is part of the Spiralcraft project and is licensed under import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; public class Main { public static String dumpResultSet(ResultSet rs) throws SQLException { ResultSetMetaData md = rs.getMetaData(); StringBuffer buf = new StringBuffer(); int count = md.getColumnCount(); buf.append("\r\n"); for (int i = 0; i < count; i++) { if (i > 0) { buf.append(","); }/*w ww .j a v a 2 s .co m*/ buf.append(md.getColumnName(i + 1)); } while (rs.next()) { buf.append("\r\n"); for (int i = 0; i < count; i++) { if (i > 0) { buf.append(","); } buf.append(rs.getObject(i + 1)); } } buf.append("\r\n"); return buf.toString(); } }