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".