I have a csv file uploaded by user, which I need to store as a Clob, in oracle table.
Therefore I have this code:
MultipartHttpServletRequest mr = (MultipartHttpServletRequest) ctx.getRequest();
final MultipartFile f = mr.getFile("datafile");
final InputStream is = f.getInputStream();
...
jdbc.getJdbcOperations().execute(sql, new PreparedStatementCallback<Integer>() {
public Integer doInPreparedStatement(final PreparedStatement psInsert) throws SQLException,
DataAccessException {
...
psInsert.setCharacterStream(1, new InputStreamReader(is));
psInsert.executeUpdate();
}
});
Also, I've tried using methods setClob and setAsciiStream of PreparedStatement, as well as I've tried this approach (setting the size of the file), but result is the same -
java.lang.AbstractMethodError
org.apache.commons.dbcp.DelegatingPreparedStatement.setAsciiStream(DelegatingPreparedStatement.java:338)
org.apache.commons.dbcp.DelegatingPreparedStatement.setAsciiStream(DelegatingPreparedStatement.java:338)
org.apache.commons.dbcp.DelegatingPreparedStatement.setAsciiStream(DelegatingPreparedStatement.java:338)
The underlying InputStream is ByteArrayInputStream (if that could make any difference)
PS: The table really has CLOB field:
P_FILE CLOB NOT NULL,
UPD: I haven't actually tried the Oracle implemented methods. It works, the only problem is the oracle driver implements not all of the methods comparing to those which are in the PreparedStatement interface. The class to look at the possible available methods is OraclePreparedStatement ...