0

次の方法を使用して検索結果を取得しようとしましたがjava.sql.SQLException: Exhausted Resultset、catch ブロックのようにエラーが残ります。これは、結果を取得した後に表示されます。検索も非常に遅いようです。

private static OracleConnection connection = null;
    private static OraclePreparedStatement ptmst = null;
    private static OracleResultSet rs = null;
    private static OracleCallableStatement cstmt = null;


 public static ArrayList particleSearch(BigDecimal myId,BigDecimal deId,String search_term,JspWriter out )throws Exception
  {
    StringBuffer sql = new StringBuffer();
    ArrayList particles = new ArrayList();
    try
    {

      connection = (OracleConnection) TransactionScope.getConnection();
      sql.append("select distinct(..)......... ");  
      ptmst = (OraclePreparedStatement)connection.prepareStatement(sql.toString());
      ptmst.setBigDecimal(1,deId);
      ptmst.setBigDecimal(2,myId);
      ptmst.setString(3,search_term);
      rs = (OracleResultSet)ptmst.executeQuery();               

      while (rs.next()) 
                {                  
                HashMap hashParticles = new HashMap();
                hashParticles.put("part1",rs.getString(1));
                hashParticles.put("part2",rs.getString(2)); 
                hashParticles.put("part3",rs.getBigDecimal(3));                                                 
                particles.add(hashParticles);
                }

       connection.commit();


     }
     catch (Exception e) {
        out.println("Er:"+e.toString());  ///// throws error:: Er:java.sql.SQLException: Exhausted Resultset 
        }
     finally {

            try {
                if (ptmst != null) {
                    ptmst.close();
                }
            } catch (Exception e) {
            out.println(e.toString());
            }

            try {
                if (connection != null) {
                    TransactionScope.releaseConnection(connection);
                }
            } catch (Exception e) {
            out.println(e.toString());
            }

        }
        return particles; 
  } 
4

0 に答える 0