} else {
sql = tableManipulation.getUpdateRowSql();
}
Connection connection = null;
PreparedStatement ps = null;
ByteBuffer byteBuffer = null;
try {
byteBuffer = JdbcUtil.marshall(getMarshaller(), ed.toInternalCacheValue());
if (log.isTraceEnabled()) {
log.tracef("Running sql '%s' on %s. Key string is '%s', value size is %d bytes", sql, ed, lockingKey, byteBuffer.getLength());
}
connection = connectionFactory.getConnection();
ps = connection.prepareStatement(sql);
ps.setBinaryStream(1, byteBuffer.getStream(), byteBuffer.getLength());
ps.setLong(2, ed.getExpiryTime());
ps.setString(3, lockingKey);
ps.executeUpdate();
} catch (SQLException ex) {
log.sqlFailureStoringKey(lockingKey, byteBuffer.getLength(), ex);
throw new CacheLoaderException(String.format(
"Error while storing string key to database; key: '%s', buffer size of value: %d bytes",
lockingKey, byteBuffer.getLength()), ex);
} catch (InterruptedException e) {
if (log.isTraceEnabled()) {
log.trace("Interrupted while marshalling to store");
}
Thread.currentThread().interrupt();