Urgent!--error in SQL:maximun open cursors excceed

Discussions

EJB programming & troubleshooting: Urgent!--error in SQL:maximun open cursors excceed

  1. Urgent!--error in SQL:maximun open cursors excceed (2 messages)

    I use jdbc to connect Oracle database,jdbc driver is "classes111.zip" which provided by Oracle8i.
    I know if we open too much resultset and forget to close there could occurs such error,but in my program I do close after use RecordSet ,but I code like this because of the complex logic:

    Connection con=...;
    for(...){
      Statement st=con,createStatement();
      ResultSet rs=st.excecuteQuery("...");
      while(rs.next()){
        Statement st1=...;
        ResultSet rs1=...;
        ...;
        rs1.close();
        st1.close();
       }
       rs.close();st.close();
    }

    is there any problem?

    if someone knows ,ps. tell me as quick as possible.thanks a lot

  2. I too had the same problem. But I was not closing Statement and when I corrected it it is working fine. I used classes12_01.zip. If you are using JDK1.2.x and above
    and Oracle 8.1.5 and above please download classes12.zip(latest on the Site technet.oracle.com )
    and try.
  3. You need to be sure to close your Statement objects. You should do this inside of a finally block to assure they close even if you have an exception in your SQL call. Note you only need to close Statements and their subclasses as this will close all associated ResultSet implementations.

    Dave Wolf
    Internet Applications Division
    Sybase