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;
    }

大家好。我有上面的示例代码。问题是返回的行集总是空的,即使数据库中有很多数据。有什么建议么?谢谢你。

4

0 回答 0