You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Fernanda Pizzorno (JIRA)" <de...@db.apache.org> on 2006/09/18 15:59:25 UTC

[jira] Commented: (DERBY-1295) Result sets of type TYPE_SCROLL_INSENSITIVE should not implicitly close due to positioning in autocommit mode

    [ http://issues.apache.org/jira/browse/DERBY-1295?page=comments#action_12435483 ] 
            
Fernanda Pizzorno commented on DERBY-1295:
------------------------------------------

Release note for this issue:


PROBLEM
SCROLL_INSENSITIVE result sets in auto commit mode close implicitly when calling the ResultSet.next() method while positioned on the last row.

SYMPTOMS
Calling the ResultSet.next() method when positioned on the last row of a result set of type SCROLL_INSENSITIVE in auto commit mode causes the result set to be closed.

CAUSE
The JDBC specification allows a JDBC driver to implicitly close a ResultSet when the ResultSet type is TYPE_FORWARD_ONLY and the next method of ResultSet returns false. Derby also implicitly closes result sets of type SCROLL_INSENSITIVE when the ResultSet.next() method returns false in auto commit mode.

SOLUTION
The behavior of SCROLL_INSENSITIVE result sets in auto commit mode has been changed to comply with the JDBC4 specification. SCROLL_INSENSITIVE result sets are not implicitly closed when calling the ResultSet.next() method in auto commit mode while positioned on the last row.

WORKAROUND

> Result sets of type TYPE_SCROLL_INSENSITIVE should not implicitly close due to positioning in autocommit mode
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1295
>                 URL: http://issues.apache.org/jira/browse/DERBY-1295
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.1.0
>            Reporter: Dag H. Wanvik
>         Assigned To: Fernanda Pizzorno
>            Priority: Minor
>             Fix For: 10.2.1.0
>
>         Attachments: derby-1295.diff, derby-1295.stat, derby-1295v2.diff, derby-1295v2.stat, derby-1295v3.diff, derby-1295v3.stat, Main.java
>
>
> The new JDBC 4 specification allows implementations to automatically
> close result sets of type FORWARD_ONLY when ResultSet#next returns
> false:
> (quote from JDBC preliminary spec):
> > 16.2.5 Closing a ResultSet Object
> >       :
> > NOTE: Some JDBC driver implementations may also implicitly close the
> > ResultSet when the ResultSet type is TYPE_FORWARD_ONLY and the next
> > method of ResultSet returns false.
> This implies that other result set type are not free to do this.
> Currently, Derby will also implicitly close result sets of type
> TYPE_SCROLL_INSENSITIVE, if autocommit is enabled. 
> Quote from Derby Developer's Guide, subsection "Using autocommit":
>  
> > Using auto-commit 
> >
> > A new connection to a Derby database is in auto-commit mode by
> > default, as specified by the JDBC standard. Auto-commit mode means
> > that when a statement is completed, the method commit is called on
> > that statement automatically. Auto-commit in effect makes every SQL
> > statement a transaction. The commit occurs when the statement
> > completes or the next statement is executed, whichever comes
> > first. In the case of a statement returning a ResultSet , the
> > statement completes when the last row of the ResultSet has been
> ****************************************
> > retrieved or the ResultSet has been closed explicitly.
> This seems to indicate that result set always closes when the last row
> has been seen, however, it seems the implementation only does this
> when autocommit is enabled.  I will attach a repro.
> Anyway, this should be corrected for JDBC4 compliancy. Scrollable
> result sets should never close implicitly due to positioning,
> autocommit or not.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira