CachedRowSet始终返回空

时间:2018-06-11 11:54:55

标签: try-with-resources cachedrowset

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

大家好。我有一个如上所示的示例代码。问题是返回的rowset总是为空,即使数据库中有大量数据。 有什么建议?谢谢。

0 个答案:

没有答案
相关问题