Convert in JAVA class => String to CLOB
455723Sep 23 2005 — edited Sep 27 2005Hi!
I just want to convert a simply String or Document type into the Oracle CLOB datatype, beacause I use a stored Procedure with an CLOB argument.
(not to mix with writing a CLOB into a oracle database).
I need some help, I tried this here:
public void setdataPackage(Document data, float cid) {
Connection conn = null;
CallableStatement cs = null;
try {
conn= pool.getConnection(2000);
conn.setAutoCommit(false);
CLOB newClob = CLOB.createTemporary(conn, false, oracle.sql.CLOB.DURATION_CALL);
newClob.setString(1, data.toString());
if(conn != null){
cs = conn.prepareCall("{call SETDATAPACKAGE(?, ?)");
try{
//Inputvalues
cs.setClob(1, newClob);
cs.setFloat(2, cid);
// execute PROCEDURE
cs.execute();
}
catch(Exception e){
System.out.println("CLOB Exception: "+ e);
}
cs.close();
}
else
System.out.println("Connection faild!!!");
}
catch (SQLException e) {
System.out.println("setDataPackage Exception: "+ e);
}
finally{
try{
conn.close();
}
catch(SQLException e){
System.out.println("Connection Close Exception: "+ e);
}
}
}