Java Utililty Methods SQL ResultSet Dump

List of utility methods to do SQL ResultSet Dump

Description

The list of methods to do SQL ResultSet Dump are organized into topic(s).

Method

voiddump(ResultSet rs)
dump
ResultSetMetaData meta = rs.getMetaData();
int colmax = meta.getColumnCount();
int i;
Object o = null;
for (; rs.next();) {
    for (i = 0; i < colmax; ++i) {
        o = rs.getObject(i + 1); 
        System.out.print(o.toString() + " ");
...
voiddump(ResultSet rset)
dump
if (rset != null) {
    try {
        while (rset.next() == true) {
            int nb = rset.getMetaData().getColumnCount();
            for (int i = 1; i <= nb; i++) {
                System.out.print(rset.getObject(i).toString() + " ; ");
            System.out.println("");
...
voiddump(ResultSet set)
dump
ResultSetMetaData data = set.getMetaData();
System.err.println();
while (set.next()) {
    for (int i = 1; i <= data.getColumnCount(); i++) {
        System.err.print(data.getColumnName(i));
        System.err.print(":");
        System.err.println(set.getObject(i));
    System.err.println();
voiddumpResultSet(ResultSet dbResult)
dump Result Set
try {
    ResultSetMetaData md = dbResult.getMetaData();
    int count = md.getColumnCount();
    dumpResultSetMetaData(dbResult);
    while (dbResult.next()) {
        for (int i = 1; i <= count; i++) {
            String colValue = dbResult.getString(i);
            System.out.print(colValue + "\t");
...
List>dumpResultSet(ResultSet resultSet, String tablename, String[] columns)
Dump result set.
List<List<Object>> l = new ArrayList<List<Object>>();
List<Object> t = new ArrayList<Object>();
t.add(tablename);
l.add(t);
Map<String, Boolean> cs = new Hashtable<String, Boolean>();
if (columns != null) {
    for (int i = 0, n = columns.length; i < n; i++) {
        cs.put(columns[i].toLowerCase(), true);
...
voiddumpResultSet(ResultSet rs)
Dumps the contents of a result set.
ResultSetMetaData md = rs.getMetaData();
int cc = md.getColumnCount();
int r = 1;
while (rs.next()) {
    System.out.println("Record " + (r++));
    for (int i = 1; i <= cc; i++) {
        System.out.println("  " + md.getColumnName(i) + ": " + rs.getObject(i));
StringdumpResultSet(ResultSet rs)
dump Result Set
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(",");
    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();
voiddumpResultSetMetaData(ResultSet dbResult)
dump Result Set Meta Data
try {
    ResultSetMetaData md = dbResult.getMetaData();
    int count = md.getColumnCount();
    for (int i = 1; i <= count; i++) {
        System.out.print(md.getColumnName(i) + " [" + md.getColumnTypeName(i) + "]\t");
    System.out.println();
} catch (SQLException e) {
...
voiddumpRs(ResultSet rs, PrintWriter out, String delimiter, boolean printTrailingDelimiter)
dump Rs
if (!rs.next()) {
    out.println("no rows to display");
    out.flush();
    return;
java.sql.ResultSetMetaData meta = rs.getMetaData();
int c = meta.getColumnCount();
int types[] = new int[c];
...