ORA-01000: Oracle maximum open cursors exceeded in Spring Boot
I have noticed this error on occasion if a large number of queries were executed in a short time. Even though connections were being managed with a jdbcTemplate, the cursors were not getting closed. This issue was not related to the application code structure, transaction management, nor anything else relating to the connection, yet the statements continually failed to close properly.
There is a bug in older versions of Oracle OJDBC libraries which does not play nice with Spring’s JDBC connection management libraries. To fix this, update your OJDBC jar to the latest version.
Latest version of the Oracle OJDBC8 Jar:
<dependency> <groupId>com.oracle.ojdbc</groupId> <artifactId>ojdbc8</artifactId> <version>18.104.22.168</version> </dependency>
Latest version of the Oracle OJDBC10 Jar:
<dependency> <groupId>com.oracle.ojdbc</groupId> <artifactId>ojdbc10</artifactId> <version>22.214.171.124</version> </dependency>
You can also find these JDBC drivers available for download from Oracle