code: public static String queryString(PreparedStatement stmt, String def) throws SQLException {
      ResultSet rs = null;
      try {
        rs = stmt.executeQuery();
        return rs.next() ? rs.getString(1) : def;
      } finally {
        close(rs);
      }
    }
docs: Runs a SQL query that returns a single <code>String</code> value.
  @param stmt The <code>PreparedStatement</code> to run.
  @param def The default value to return if the query returns no results.
  @return The value returned by the query, or <code>def</code> if the
  query returns no results.  It is assumed that the query
  returns a result set consisting of a single row and column, and
  that this value is a <code>String</code>.  Any additional rows or
  columns returned will be ignored.
  @throws SQLException If an error occurs while attempting to communicate
  with the database.