Re: Is perl better? :(((

From: Dimitri Maziuk (dima_at_127.0.0.1)
Date: 02/05/05


Date: Sat, 5 Feb 2005 18:51:55 +0000 (UTC)

Chris Smith sez:
> Joe Weinstein <joeNOSPAM@bea.com> wrote:
>> Oracle's JDBC driver
>> > should not be holding a ResultSet open across a Connection.close() --
>> > nor a commit() unless a non-default holdability was set using JDBC3's
>> > new overloads of createStatement and prepareStatement.
>>
>> I'll catch up on the thread. Is that happening?
>
> I don't know. Lee suggested that it is happening. I hope he's wrong.

Yep, he is. I don't know about result sets returned from stored
procedures, but regular ones get closed as per specs (at least
in 8i and 10g).

IME it's statement.close() that releases server-side cursor;
you want to explicitly close your statements ASAP, if you leave
that to gc you're likely to run out of cursors. Moreover, it
seems that gc'ing unclosed statements does not always close
server side of the connection, sometimes it sits there hours
waiting to time out.

>> I always close everything asap... Chaqu'un a son gout... but yes, I wasn't
>> reading the thread.
>
> I certainly would not argue for leaving things open indefinitely.
> Specifically, though, we're discussing whether it's reasonable to omit a
> call to ResultSet.close() in the middle of a tight loop of calls to
> PreparedStatement.executeQuery(). As far as I'm concerned, that IS
> basically closing things ASAP; the next call to executeQuery is going to
> happen immediately, and it will close the ResultSet.

I always close the statements and usually close associated result
set just before stat.close(), just to be sure. I never close the
result set in a middle of a loop (tight or not) and so far I haven't
run into any problems.

... Unless Lee is
> right about Oracle's driver bug...

There's 2 thin drivers in 10g: new ...OracleDriver and old
...driver.OracleDriver. The old one is retained for compatibility
backwards, all bugfixes and new features go into new one. Plus
there's not-thin driver(s?), RowSet implementation jar, etc.
There may be that Lee's bug is in one or two of them, who knows...

Dima

-- 
Riding roughshod over some little used trifle like the English language is not a
big deal to an important technology innovator like Microsoft. They did just that
by naming a major project dot-Net (".Net").  Before that, a period followed by a
capital letter was used to mark a sentence boundary. --T. Gottfried, RISKS 21.91


Relevant Pages

  • Re: Is perl better? :(((
    ... >> Oracle's JDBC driver ... IME it's statement.closethat releases server-side cursor; ... > call to ResultSet.closein the middle of a tight loop of calls to ... There may be that Lee's bug is in one or two of them, ...
    (comp.lang.java.programmer)
  • Re: Stored Procedure error is not catched
    ... I also test this code with JTDS JDBC Driver and it works. ... >>> tell me how to fix this bug? ... The problem is that the SQLException (or really the error message ... you do get your expected exception. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: getParameterMetaData bug?
    ... the keyword 'FROM'" for a query such as the following seems to be a bug in ... the JDBC driver. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: Can 2005 JDBC driver return correct procedure names?
    ... JDBC driver and we are working on a fix for this bug. ... correcting these names are being evaluated. ...
    (microsoft.public.sqlserver.jdbcdriver)