用一个group by 的sql查询,但是发现查询出来的rs只要一操作(比如rs.next)就说我rs已经关闭,报sqlException的错误。
直接用sql是可以查询出来结果的。也已确认已经得到连接conn了。不知咋回事,请高手指教。 /**
 * group by 语句查询现在的回访数量
 * @return
 * @throws Exception
 */
public ArrayList selectSummary() {
    ArrayList al = new ArrayList();
    Statement stmt = null;
    ResultSet rs = null;
    Connection conn = null;
    String sql = "select CALL_RESULT_DESCRIPTION,count(*) from OBT_TEST_TABLE where CALL_RECORD_TYPE <> 0 group by CALL_RESULT_DESCRIPTION";
CommonLogger.logger.debug(sql);    
    try {
conn = AppHandle.getHandle("newCallback").getConnection();
    } catch (Exception e1) {
e1.printStackTrace();
    }
CommonLogger.logger.debug(conn.toString());
    try {
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
rs.next();
CommonLogger.logger.debug(rs.getString(1));
while (rs.next()) {
    al.add(rs.getString(1));
    al.add(rs.getString(2));
    al.add("1");
CommonLogger.logger.debug("第一列的值");
}
    } catch (SQLException e) {
e.printStackTrace();
CommonLogger.logger.debug("selectSummary方法:查询select  SQLException");
    } finally {
try {
    if (rs != null) rs.close();
    if (stmt != null) stmt.close();
    if (conn != null) conn.close();
} catch (SQLException e) {
    e.printStackTrace();
    CommonLogger.logger.debug("select方法:查询select出现异常,finally里面关资源也还是出错了");
}
    }     return al;
}