public static String getLargeTextField(ResultSet rs, int columnIndex) throws SQLException {
        if (isStreamTextRequired()) {
            String value;
            try (Reader bodyReader = rs.getCharacterStream(columnIndex)) {
                if (bodyReader == null) {
                    return null;
                }
                char[] buf = new char[256];
                int len;
                StringWriter out = new StringWriter(256);
                while ((len = bodyReader.read(buf)) >= 0) {
                    out.write(buf, 0, len);
                }
                value = out.toString();
                out.close();
            }
            catch (Exception e) {
                Log.error(e.getMessage(), e);
                throw new SQLException("Failed to load text field");
            }
            return value;
        }
        else {
            return rs.getString(columnIndex);
        }
    }
Retrives a large text column from a result set, automatically performing
streaming if the JDBC driver requires it. This is necessary because
different JDBC drivers have different capabilities and methods for
retrieving large text values.

@param rs the ResultSet to retrieve the text field from.
@param columnIndex the column in the ResultSet of the text field.
@return the String value of the text field.
@throws SQLException if an SQL exception occurs.
xmppserver/src/main/java/org/jivesoftware/database/DbConnectionManager.java