0

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Adithya N
  • 1
  • 2
  • It seems that createClob() is not being implemented in postgresql for now. Is there any other Spring-jdbc version that doesn't invoke the createClob() method. @Override public Clob createClob() throws SQLException { checkClosed(); throw org.postgresql.Driver.notImplemented(this.getClass(), "createClob()"); } – Adithya N Mar 01 '23 at 21:45
  • While debugging, the application is trying to update the BATCH_STEP_EXECUTION_CONTEXT table. This in turn is invoking the createClob() method from postgresql.jar via TemporaryLobCreator.java class in Spring-jdbc-4.0.5.RELEASE-sources.jar. – Adithya N Mar 01 '23 at 21:45

2 Answers2

0

Checking your stack, it looks that Spring is being used.

According to this answer, and this website you need to set the parameter.

0

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.

Adithya N
  • 1
  • 2