1
public CachedRowSet execute(String asql) throws ServiceUnavailableException {
        try (Connection connection = getDatabaseConnection();
             Statement statement = connection.createStatement();) {
             try (ResultSet resultSet = statement.executeQuery(asql);
                  CachedRowSet rowset = CachedRowSetFactory.getCachedRowSet()) {
                  rowset.populate(resultSet);
                  return rowset;
             }
        } catch (SQLException se) {
            throw new ServiceUnavailableException("Database broken " + se);
        } catch (Exception ne) {
            throw new ServiceUnavailableException("JNDI Lookup broken ");
        }
        return null;
    }

Hi everyone. I have a sample code as above. The problem is that returned rowset is always empty, even though there are lots of data in database. Any suggestions? Thank you.

Teddy
  • 11
  • 3

0 Answers0