I am working on an application that uses Spring JDBC and postgresql-42.4.24.jar. While executing an update query, the batch application fails with the below exception.
Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:699) ~[postgresql-42.2.24.jar:42.2.24]
at org.postgresql.jdbc.PgConnection.createClob(PgConnection.java:1344) ~[postgresql-42.2.24.jar:42.2.24]
at org.apache.commons.dbcp2.DelegatingConnection.createClob(DelegatingConnection.java:868) ~[commons-dbcp2-2.1.1.jar:2.1.1]
at org.apache.commons.dbcp2.DelegatingConnection.createClob(DelegatingConnection.java:868) ~[commons-dbcp2-2.1.1.jar:2.1.1]
at org.springframework.jdbc.support.lob.TemporaryLobCreator.setClobAsString(TemporaryLobCreator.java:101) ~[spring-jdbc-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao$1.setValues(JdbcExecutionContextDao.java:238) ~[spring-batch-core-3.0.3.RELEASE.jar:3.0.3.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:914) ~[spring-jdbc-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:909) ~[spring-jdbc-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644) ~[spring-jdbc-4.0.5.RELEASE.jar:4.0.5.RELEASE]
Note I am not using Spring JPA or Hibernate for this application. Please help me resolve this issue.
The batch application should run as expected completing all update queries. Since this is a legacy application, it doesn’t use Spring JPA or Hibernate.
2
Answers
The Spring-JDBC framework depends on the creation of DefaultLobHandler which is invoking postgresql to implement the createClob() method.
In order to prevent this, please assign the property createTemporaryLob within defaultLobHandler to false. This should resolve the issue for any EJB related batch applications.
Checking your stack, it looks that Spring is being used.
According to this answer, and this website you need to set the parameter.