Java Utililty Methods SQL ResultSet String Read

List of utility methods to do SQL ResultSet String Read

Description

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

Method

StringgetString(ResultSet rs, String name, String ifnull)
get String
String val = rs.getString(name);
return ((val != null) ? val : ifnull);
voidgetStringChunks(ResultSet rs, int colIndex, StringBuffer buf)
get String Chunks
char[] buffer = new char[1024000];
int charRead = 0;
try {
    Reader input = rs.getCharacterStream(colIndex);
    while ((input != null) && ((charRead = input.read(buffer)) != -1)) {
        buf.append(buffer, 0, charRead);
} catch (Exception e) {
...
StringgetStringFromResultSetEmptyIsNull(ResultSet rset, String fieldName)
get String From Result Set Empty Is Null
String string = rset.getString(fieldName);
if (string != null && string.isEmpty())
    return null;
return string;
ListgetStringList(ResultSet resultSet, String columnName)
Returns a list of string values using a given SQL result set and column name.
List<String> values = null;
if (resultSet != null && columnName != null) {
    values = new ArrayList<String>();
    while (resultSet.next()) {
        values.add(getString(resultSet, columnName));
return values;
...
StringgetStringSuppressSQLException(final ResultSet rs, final String columnLabel)
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language suppressing SQLException
String columnValue = null;
try {
    columnValue = rs.getString(columnLabel);
} catch (SQLException ex) {
return columnValue;
StringgetStringUTF8(ResultSet rs, String which)
get String UTF
if (db_Derby) { 
    String str = rs.getString(which);
    if (rs.wasNull())
        return null;
    return str;
byte rv[] = rs.getBytes(which);
if (rs.wasNull())
...
StringgetStringValue(final ResultSet rs, final int index)
get String Value
try {
    return rs.getString(index);
} catch (SQLException ex) {
    return null;
StringgetTrimmedStringToUpperCase(ResultSet rs, String columnLabel)
get Trimmed String To Upper Case
return getString(rs, columnLabel) != null ? nullIfEmpty(getString(rs, columnLabel).toUpperCase()) : null;