Issue Details (XML | Word | Printable)

Key: DERBY-3469
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Tiago R. Espinha
Reporter: Kristian Waagan
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Clob.length() doesn't detect a closed underlying connection in a consistent way

Created: 26/Feb/08 10:07 AM   Updated: 04/May/09 06:22 PM
Return to search
Component/s: JDBC, Network Client
Affects Version/s: 10.3.2.1, 10.4.1.3, 10.5.1.1
Fix Version/s: 10.4.2.0, 10.5.1.1

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works ClosedClobTest.java 2008-05-26 08:22 AM Kristian Waagan 4 kB
Java Source File Licensed for inclusion in ASF works ClosedClobTest.java 2008-02-26 10:10 AM Kristian Waagan 2 kB
Environment: Client-driver
Issue Links:
Reference
 

Resolution Date: 26/May/08 01:37 PM


 Description  « Hide
Depending on the state of the Clob, the method length gives two different SQL states when the underlying connection has been closed.
According to BlobClob4BlobTest.testClobAfterConnectionClose, it should throw 08003 (no current connection), but it might also throw XJ215 (invalid lob).

I think this is caused indirectly by the following method in Lob:
    long sqlLength() throws SqlException
    {
        if (lengthObtained_) return sqlLength_;
        
        if (isLocator()) {
            sqlLength_ = getLocatorLength();
            lengthObtained_ = true;
        } else if (willBeLayerBStreamed()) {
            throw new SqlException(agent_.logWriter_,
                                   LOB_OBJECT_LENGTH_UNKNOWN_YET);
        } else {
            materializeStream(); // Will set sqlLength_
        }

        return sqlLength_;
    }

In this method, getLocatorLength will check for a closed connection (somewhere down in prepareCallX i believe), whereas the cached length is returned if it has already been determined. Clob.length does not check for a closed connection.
There are multiple fixes, but I think a proper investigation should be carried out before a solution is chosen.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.