Many friends in Java Development, when using Oracle database, often encounter a ORA-01000: maximum open cursors exceeded. Error.
In fact, the main cause of this error isCodeProblem.
Ora-01000: maximum open cursors exceeded.
Indicates that the maximum number of opened cursors has been reached for a process.
The main cause of this error is that the Java code is executing Conn. createstatement () and conn. when preparestatement () is used, it is equivalent to opening a cursor in the database. In particular, if your createstatement and preparestatement are in a loop, this issue is very likely to occur. Because the cursor is always open and not closed.
In general, when writing Java code, both createstatement and preparestatement should be placed outside the loop and closed in time after these statment are used. It is best to disable statment immediately after executing executequery, executeupdate, and so on without using the resultset data.
For the case of ORA-01000 errors, simply increase open_cursors is not a good way, it is just a temporary cure. In fact, the hidden risks in the Code have not been removed.
In most cases, open_cursors only needs to set a small value, which is enough unless there are special requirements.