Here you can find the source of printRecord(PrintWriter pw, ResultSet rs)
public static void printRecord(PrintWriter pw, ResultSet rs) throws SQLException
//package com.java2s; //License from project: Open Source License import java.io.PrintWriter; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; public class Main { public static void printRecord(PrintWriter pw, ResultSet rs) throws SQLException { ResultSetMetaData rsmd = rs.getMetaData(); printRecord(pw, rs, rsmd);/*from w w w .j av a 2 s. c om*/ } public static void printRecord(PrintWriter pw, ResultSet rs, ResultSetMetaData rsmd) throws SQLException { for (int i = 1; i <= rsmd.getColumnCount(); i++) { String value = rs.getString(i); if (value == null) { value = ""; } pw.print((i == 1 ? value : "\t" + value)); } pw.println(); } }