In Java Development, when using Oracle database, it is often encountered with ORA-01000: maximum open cursors exceeded. Error.
In fact, the cause of this error is mainly caused by code problems.
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.