Thanks for ur reply Dave. But then I would like to ask you a few more
things. U have written:
"You should always close your Statement object.  Do note that closing the
Statement will also close associated ResultSet objects."
Well correct me if i am wrong.
1. I thought the cursors get open only after a we fire a query resulting in
some records being obtained. Now do the cursor also gets open just by
preparing a statement?

2. Also if i opt to do ResultSet.Close() and not Statement.Close() then the
cursor will still get closed or still remain open until Statement.close() is
executed?

    Thanking you in advance.

Regards,
Prateek.


----- Original Message -----
From: Dave Wolf <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 10, 2000 3:12 AM
Subject: Re: Max Open Cursors Exceeded


> Yes this will absolutely leave the Statement objects as leaked.  In some
> RDBMS implementations this willo mean the RDBMS will run out of cursors.
> You should always close your Statement object.  Do note that closing the
> Statement will also close associated ResultSet objects.
>
> Dave Wolf
> Internet Applications Division
> Sybase
>
> ----- Original Message -----
> From: "Prateek Asthana" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, November 10, 2000 1:30 PM
> Subject: Max Open Cursors Exceeded
>
>
> > Hello Friends,
> >     I am getting Max Open Cursors Exceeded Exception. I am making and
> > closing Connections to my Oracle database from my Session Bean. The code
> is
> > given below:
> >
> > func()
> > {
> >         conn = ds.getConnection();
> >         conn.setAutoCommit(false);
> >         Statement stmt;
> >         try
> >         {
> >             stmt = conn.createStatement();
> >             stmt.executeUpdate(sql);
> >         }
> >         catch (Exception sql_ex)
> >         {
> >              conn.close();
> >        }
> >
> >         try
> >         {
> >             conn.close();
> >         }
> >         catch (Exception conn_ex)
> >         {
> >         }
> > }
> >
> > Now as seen above I am not closing my Statement object by doing
> > stmt.close(). Also in some other section of my program i am obtaining a
> > Result Set. But at the end I am only closing the Connection and not
> closing
> > the ResultSet. Will this lead to Max Open Cursors Exceeded Exception? Is
> it
> > not that only closing the Connection Object by calling conn.close() even
> > closes the cursors.
> >
> >     Thanking in advance.
> >
> > Regards,
> > Prateek
> >
> >
>
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff EJB-INTEREST".  For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to