I am getting this error for Clob datatype in table. The String content I am trying to store as clob is more than 4K for sure (around 190KB). I am using JPA in spring app.
Consider responseObj is a JSONObject with 190K of data.
Clob errorResponse = new javax.sql.rowset.serial.SerialClob(responseObj.toString().toCharArray());
errorResponse.setString(1L,responseObj.toString());
int rowsInserted = errorRepository.insertEfileErrorLogRequest(responseObj.getString("key"), Short.parseShort(year), errorResponse);
ErrorRepository.insertErrorLogRequest()
@Modifying
@Query(value="INSERT INTO ERRORLOG " +
"(KEY,YEAR,ERROR_CLOB,TIMESTAMP) " +
"VALUES " +
"(?1,?2,
"TO_CLOB(?3),SYSTIMESTAMP)",nativeQuery = true)
int insertErrorLogRequest(String key, short year, Clob errorResponse) throws SQLException, DataAccessException;
There is no long column in the database table. I am getting ORA-01461: can bind a LONG value only for insert into a LONG column
I am using Oracle 11g & ojdbc14 maven dependency
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>