SQL/MX Programming Manual for Java
SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java—523726-003
3-66
Lost Open Error (8574)
iter.close();
} // End of try block
// Handles chained SQL exceptions from the try block
catch (SQLException se) {
while (se != null) {
System.out.println("SQL exception: " + se.getMessage());
se = se.getNextException();
}
} // End of catch block
} // End of main() method
} // End of class ChainedExceptionExample
Lost Open Error (8574)
When an SQLJ program accesses a table or view by using a DML statement or an
iterator, SQL/MX opens the table or view and holds it open until the program stops
executing. If the DML statement or iterator, or the transaction containing the statement
or iterator, allows concurrent access to the table or view, the program could lose its
open on the table or view to a DDL or SQL utility operation. The DDL or utility
operation invalidates the open held by the program to change the structure of the table
or view and gains exclusive access to the table or view. A program could also lose its
open on a table or view when a network or hardware interruption occurs.
Occurrences of the Lost Open Error
If a DML statement partially modifies a database object (that is, table, view, and so on)
before the open is invalidated, the SQL/MX executor rolls back the changes made by
the statement and returns the Lost Open Error (8574) to the program. For example,
consider an INSERT statement on a table that has an index. The INSERT statement
always modifies the table first before updating the index. If the index is destroyed, the
Lost Open Error occurs.
If an iterator returns one or more rows to the program before the open is invalidated,
the SQL/MX executor returns the Lost Open Error (8574) to the program. If an iterator
or DML statement does not return any rows to the program before the open is
invalidated, the SQL/MX executor retries the iterator or DML statement and then waits
for the lock to be released on the table or view. If the lock is not released before the
timeout is reached, the SQL/MX executor returns the Lost Open Error (8574) to the
program.
If the lock is released before the timeout is reached, the SQL/MX executor reopens the
table or view. If reopening the table or view results in a timestamp mismatch, the
SQL/MX executor performs a similarity check of the table or view. If the similarity check
fails (or is disabled), the SQL/MX executor tries to automatically recompile the
statement. If the SQL/MX executor cannot recompile the statement, it returns the Lost
Open Error (8574), as well as other recompilation errors, to the program. For more
information about similarity checks and automatic recompilation, see Similarity Checks
and Automatic Recompilation on page 4-26.