Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The question about CLOB serialize? Thank you !!!

 
Mo Jialin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
parameter explain:
* Connection conn, : connection
* String atable : table name
* String alobcol : the CLOB name in table
* String acondition, : the condition that didn't include 'Where'
* String acontent : the content that I want to insert

the code I have writed as follow:
***************************************************
try {
//conn.setAutoCommit(false);
// at first ,set sql's value = 'null'
sql = "update " + atable + " set " + alobcol + " = empty_clob() where " +
acondition;
stmt = conn.createStatement();
stmt.executeQuery(sql);
stmt.close();
sql = "select " + alobcol + " from " + atable + " where " + acondition +
" for update";
stmt = conn.createStatement();
rset = stmt.executeQuery(sql);
if (rset.next()) {
oracle.sql.CLOB clob = (oracle.sql.CLOB)rset.getClob(1);
clob.putString(1, acontent);
psql = "update " + atable + " set " + alobcol + "=? where " +
acondition;
pstmt = conn.prepareStatement(psql);
pstmt.setClob(1, clob);
pstmt.executeUpdate();
}
conn.commit();
}
*****************************************************

My application server is weblogic. after I have run this program,some error information were displayed as follow
*****************************************************
:::java.sql.SQLException: cann't save big text field! weblogic.jdbc.rmi.SerialOracleClob
(declare:a empty clob has been inserted in the data table )
->big moose saloon
*****************************************************
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic