Java SQL ResultSet Dump dump(ResultSet rset)

Here you can find the source of dump(ResultSet rset)

Description

dump

License

Open Source License

Declaration

public static void dump(ResultSet rset) 

Method Source Code


//package com.java2s;
/*//from  w  ww.  j  a  va  2s.  c om
* CoDIMS version 1.0 
* Copyright (C) 2006 Othman Tajmouati
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    public static void dump(ResultSet rset) {

        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("");
                }
            } catch (SQLException ex) {
                System.out.println(ex.toString());
            }
        }
    }
}

Related

  1. dump(ResultSet rs)
  2. dump(ResultSet set)
  3. dumpResultSet(ResultSet dbResult)
  4. dumpResultSet(ResultSet resultSet, String tablename, String[] columns)
  5. dumpResultSet(ResultSet rs)