# Trying to update a column of Clob type in oracle database using jdbc

I am trying to update a column of Clob type in oracle database using jdbc and below is the code:

Connection connection = getConnection();
PreparedStatement ps = null;
try
{
int i = 0;
ps = connection.prepareStatement(SQL_CODELIST_BATCH_UPDATE);
ps.setString(++i, status);

/*ByteArrayInputStream inputStream = new ByteArrayInputStream(errorLog.getBytes());

Clob clob = (java.sql.Clob)oracle.sql.CLOB.createTemporary(
connection, false, oracle.sql.CLOB.DURATION_SESSION);
clob.setString(1, errorLog);

ps.setClob(++i, clob);
ps.setString(++i, operationType);
ps.setString(++i, clipBoardId);
ps.executeUpdate();
}catch(Exception e){
e.printStackTrace();
}
finally
{
close(ps);
close(connection);
}

But issue is in both cases when i am trying to update the table is not giving any exception as well as its not updating. Problem is when i am trying to create the clob to set the column its breaking from there and directly going to finally block.And the environment used is tomcat and windows. Please suggest if there is any solution to make it work.

You can use the simple way like below:

ByteArrayInputStream inputStream = new ByteArrayInputStream(errorLog.getBytes());