List of usage examples for java.sql Clob getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.etudes.jforum.dao.oracle.OracleUtils.java
/** * Writes clob to database //from ww w . ja v a 2 s . c o m * @param query * @param idForQuery * @param value * @throws IOException * @throws SQLException */ public static void writeClobUTF16BinaryStream(String query, int idForQuery, String value) throws IOException, SQLException { PreparedStatement p = JForum.getConnection().prepareStatement(query); p.setInt(1, idForQuery); ResultSet rs = p.executeQuery(); rs.next(); Clob clobval = rs.getClob(1); if (logger.isDebugEnabled()) logger.debug("clobval is " + clobval.getClass().getName()); Writer clobWriter = clobval.setCharacterStream(0L); char[] cbuffer = new char[value.length()]; int srcBegin = 0, dstBegin = 0; value.getChars(srcBegin, value.length(), cbuffer, dstBegin); clobWriter.write(cbuffer); clobWriter.close(); rs.close(); p.close(); }