Java SQL ResultSet Read getNumRows(ResultSet query)

Here you can find the source of getNumRows(ResultSet query)

Description

get Num Rows

License

Open Source License

Declaration

public static int getNumRows(ResultSet query) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static int getNumRows(ResultSet query) {
        int numRows = 0;
        try {/*from ww  w  .  j av a 2 s.  co m*/
            if (query.last())
                numRows = query.getRow();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return numRows;
    }
}

Related

  1. getNullableInt(ResultSet resultSet, String column, int fallback)
  2. getNullableLong(ResultSet rs, String columnName)
  3. getNullDate(ResultSet result, String columnName)
  4. getNumber(ResultSet rs, String name)
  5. getNumberColumns(ResultSet rs)
  6. getObject(ResultSet resultSet, int columnCount, Map columnLabelMap, String[] fields, String[] columnLabel, Class cls, Boolean flag)
  7. getObject(ResultSet rs, int columnIndex, Class type)
  8. getObject(ResultSet set, int columnIndex)
  9. getObjectByTypeCoercion(ResultSet resultSet, int index, int dataType)