Java SQL ResultSet Read getResultSetStrings(ResultSet rs)

Here you can find the source of getResultSetStrings(ResultSet rs)

Description

get Result Set Strings

License

Apache License

Declaration

public static String[] getResultSetStrings(ResultSet rs) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.*;

public class Main {
    public static String[] getResultSetStrings(ResultSet rs) throws SQLException {
        int nCols = getNumberColumns(rs);
        String[] ret = new String[nCols];
        for (int i = 0; i < ret.length; i++) {
            ret[i] = rs.getString(i + 1);
        }//from  ww w.j ava2  s .  c  o  m
        return (ret);
    }

    public static int getNumberColumns(ResultSet rs) throws SQLException {
        ResultSetMetaData md = rs.getMetaData();
        int nCols = md.getColumnCount();
        return (nCols);
    }
}

Related

  1. GetResultSetFromQuery(String command)
  2. getResultSetFromQueryAgainstDefaultConnection( String sql)
  3. getResultSetInstance(Connection conn, String sql)
  4. getResultSetMetaData(ResultSet rs)
  5. getResultSetRowString(ResultSet rs)
  6. getResultSetValue(ResultSet rs, int index)
  7. getResultSetValue(ResultSet rs, int index)
  8. getResultSetValue(ResultSet rs, int index, Class requiredType)
  9. getResultSetValue(ResultSet rs, int index, Class requiredType)