XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 8.0pe
    • core-libs
    • b53
    • sparc
    • solaris_8
    • Not verified

      LOBs: Two of Two Locator-Based Problems.

      QUESTION: When, following the close() of its underlying ResultSet, can a LOB's Locator be released (freed)? Or, put differently, how long after the close() of its underlying ResultSet must a LOB continue to be valid?
      Some Background:

      The requirements of SQL differ somewhat from those of JDBC; some differences result from the JDBC autocommit; some because SQL gives users direct access to their choice of LOB or LOB LOCATOR, and explicit statements to manipulate LOB Locators. So, it isn't as obvious as it sometimes is that this question can be answered solely on the basis of what the SQL standard says.

      JDBC 3.0 says, 16.3.1 Retrieving BLOB and CLOB Values:
      An application does not deal directly with the LOCATOR(blob) and LOCATOR(clob) types that are defined in SQL. By default, a JDBC driver should implement the Blob and Clob interfaces using the appropriate locator type. Also by default, Blob and Clob objects remain valid only during the transaction in which they are created.

      The ANSI SQL standard says, in 4.29.5 Locators: A locator may be either valid or invalid. A host parameter or host variable specified as a locator may be further specified to be a holdable locator. When a locator is initially created, it is marked valid and, if applicable, not holdable. A <hold locator statement> identifying the locator shall be specifically executed before the end of the SQL-transaction in which it was created in order to make that locator holdable.

      A non-holdable locator remains valid until the end of the SQL-transaction in which it was generated, unless it is explicitly made invalid by the execution of a <free locator statement> or a <rollback statement> that specifies a <savepoint clause> is executed before the end of that SQL-transaction if the locator was generated subsequent to the establishment of the savepoint identified by the <savepoint clause>.
      A holdable locator may remain valid beyond the end of the SQL-transaction in which it is generated. A holdable locator becomes invalid whenever a <free locator statement> identifying that locator is executed or the SQL-transaction in which it is generated or any subsequent SQL-transaction is rolled back. All locators remaining valid at the end of an SQL-session are marked invalid when that SQL-session terminates. The requirements for SQL are clear; the close of a cursor has no effect on any locator's validity.


      ###@###.### 2004-02-02

            lancea Lance Andersen
            lancea Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: