Spring 5.0.1 namedJdbcTemplate batchUpdate ORA-01000: maximum open cursors exceeded

2.6k Views Asked by At

I have recently upgraded my project from Spring Framework 4.3.10 to 5.0.1. After the upgrade the namedParameterJdbcTemplate.batchUpdate started to fail with this error

ORA-01000: maximum open cursors exceeded.

The batch updates 250 records a time which has not changed and was working fine with Spring 4.3.x.

Has anyone came across a similar issue with Spring 5.0.1 ?

I haven't seen any changes in the Spring documentation related to usage of batchUpdate.

Any clues or is it a candidate for jire issue.

I have rolled back spring-jdbc alone to version 4.3.10 which resolved the issue. I have also raised a Jira regression defect https://jira.spring.io/browse/SPR-16139

2

There are 2 best solutions below

2
Adam Sojka On

After exchanging information via Spring JIRA ticket the following resolved the issue:

  1. Upgrading to the latest Oracle JDBC driver 12.2.0.1 (ojdbc8.jar)
  2. Creating spring.properties file with entry:spring.jdbc.getParameterType.ignore=true

The Oracle driver upgrade resolves the cursor leaking issue. The spring.properties file resolves performance issue with spring-jdbc version 5.0.1.

I expect that there will be some changes in spring-jdbc 5.0.2 that will resolve the issue without having to create custom spring.properties file.

The issue was resolved thanks to Juergen Hoeller from Spring team.

1
Adam Sojka On

Yes the issue was resolved in Spring 5.0.2:

https://github.com/spring-projects/spring-framework/issues/20687