String to Clob conversion

How do you convert from a string to clob in a java collab for insertion into an oracle table which has a field of the type clob?
[135 byte] By [moonsita] at [2007-11-26 18:27:45]
# 1
Either1. Use the proserve_dbutils.jar provided by SeeBeyond, which gives you the conversion facility.or2. Write the String as a characterstream to the CLOB field
AlanWakea at 2007-7-9 6:01:54 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 2

I don't have that jar file, but got it working with this,

protected static Clob createClob( Connection conn, String value )

throws SQLException

{

CallableStatement stmt = null;

try {

stmt = conn.prepareCall( "{ call DBMS_LOB.CREATETEMPORARY(?, TRUE)}" );

stmt.registerOutParameter( 1, oracle.jdbc.OracleTypes.CLOB );

stmt.execute();

Clob newClob = (Clob) stmt.getObject( 1 );

newClob.setString( 1, value );

return newClob;

} finally {

stmt.close();

}

}

moonsita at 2007-7-9 6:01:54 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...