Cursor Leak / ORA-1000 From PreparedStatement.getMetaData() Method On Malformed Statements
Last updated on MARCH 21, 2017
Applies to:JDBC - Version 184.108.40.206.0 to 220.127.116.11.0 [Release 11.2 to 12.1]
Information in this document applies to any platform.
Cursor leak / ORA-1000 from PreparedStatement.getMetaData() method on malformed statements when using JDBC 18.104.22.168 and 22.214.171.124.
An application allows users to enter SQL statements that will be saved for later use in processing. All these statements need to be validated against a schema, so Oracle JDBC's driver capability to parse/validate the statement without actually executing it through the use of PreparedStatement.getMetaData() method is used. Unfortunately, when the statement is incorrect, the PreparedStatement.getMetaData() method would leak the cursor and the session would eventually become "dead" due to running out of open cursors and generating ORA-01000: maximum open cursors exceeded.
The only way to recover is by closing the physical database connection through restarting the application server.
The issue occurs with JDBC versions 126.96.36.199, 188.8.131.52
The issue can be reproduced at will with the following steps:
1) Execute as sys "alter system set open_cursors=50 scope=memory;" to set some low limit for the test.
2) Make sure that your schema does not have table "foo".
3) Compile and execute the following method:
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
Million Knowledge Articles and hundreds of Community platforms