Calling Blob/Clob free() explicitly after implicit free throws exception in 
client driver
-----------------------------------------------------------------------------------------

                 Key: DERBY-5605
                 URL: https://issues.apache.org/jira/browse/DERBY-5605
             Project: Derby
          Issue Type: Bug
          Components: Network Client
    Affects Versions: 10.9.0.0
            Reporter: Kristian Waagan
            Priority: Trivial


If a Blob or Clob is freed implicitly in the client driver, calling free 
explicitly afterwards will throw an exception. Instead, this should probably be 
a no-op.

To reproduce, do something like this:
    con.setAutoCommit(false);
    Clob c = con.createClob();
    con.commit();
    c.free();

==>
Caused by: org.apache.derby.client.am.SqlException: You cannot invoke other 
java.sql.Clob/java.sql.Blob methods after calling the free() method or after 
the Blob/Clob's transaction has been committed or rolled back.
        at 
org.apache.derby.client.am.CallableLocatorProcedures.handleInvalidLocator(CallableLocatorProcedures.java:1071)
        at 
org.apache.derby.client.am.CallableLocatorProcedures.clobReleaseLocator(CallableLocatorProcedures.java:664)
        at org.apache.derby.client.am.Clob.free(Clob.java:844)
        ... 38 more
Caused by: org.apache.derby.client.am.SqlException: The exception 
'java.sql.SQLException: The locator that was supplied for this CLOB/BLOB is 
invalid' was thrown while evaluating an expression.
        at 
org.apache.derby.client.am.Statement.completeExecute(Statement.java:1604)
        at 
org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(NetStatementReply.java:322)
        at 
org.apache.derby.client.net.NetStatementReply.readExecuteCall(NetStatementReply.java:106)
        at 
org.apache.derby.client.net.StatementReply.readExecuteCall(StatementReply.java:75)
        at 
org.apache.derby.client.net.NetStatement.readExecuteCall_(NetStatement.java:175)
        at 
org.apache.derby.client.am.Statement.readExecuteCall(Statement.java:1570)
        at 
org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:2156)
        at 
org.apache.derby.client.am.PreparedStatement.executeX(PreparedStatement.java:1599)
        at 
org.apache.derby.client.am.CallableLocatorProcedures.clobReleaseLocator(CallableLocatorProcedures.java:662)
        ... 39 more
Caused by: org.apache.derby.client.am.SqlException: The locator that was 
supplied for this CLOB/BLOB is invalid
        ... 48 more

The problem dosen't exist in the embedded driver.
The immediate cause seems to be that the client driver state becomes out of 
sync with the server side. This may be fixable by dealing specifically witht 
the invalid locator exception in free().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to