Write method
String intime = new timestamp (system.currenttimemillis ()). TOSTRING ();
String sql = "INSERT INTO LWC.TAB_USER_SAY (ID_USER_SAY, MESSAGE_TITLE, MESSAGE_CONTENT, MSSSAGE_NAME, MSSSAGE_TEL, MESSAGE_EMAIL, MESSAGE_ADDRESS, MESSAGE_ZIP, OK_FLAG, IN_TIME) VALUES (LWC.SEQ_USER_SAY.NEXTVAL, '" DBUtil.FormatSQLValue (userSayForm.getMessageTitle () ) " ', empty_clob (),'" DBUtil.FormatSQLValue (userSayForm.getMessageName ()) " ','" DBUtil.FormatSQLValue (userSayForm.getMessageTel ()) " ','" DBUtil.FormatSQLValue ( userSayForm.getMessageEmail ()) " ','" DBUtil.FormatSQLValue (userSayForm.getMessageAddress ()) " ','" DBUtil.FormatSQLValue (userSayForm.getMessageZip ()) " ',' 0 ','" Intime ")";
Logger.info (SQL); // Submit Clob field content // '" DBUTIL.FORMATSQLVALUE (UserSayform.GetMassageContent ()) ", conn.setautocommit (FALSE); STAT.ExecuteUpdate (SQL); string sqll = " select MESSAGE_CONTENT from LWC.TAB_USER_SAY where IN_TIME = ' " inTime "' for update "; ResultSet rss = stat.executeQuery (sqll); if (rss.next ()) {oracle.sql.CLOB clob = ((oracle.jdbc .OracleResultSet) rss) .getCLOB (1); clob.putString (1, DBUtil.FormatSQLValue (userSayForm.getMessageContent ())); sql = "? update LWC.TAB_USER_SAY set MESSAGE_CONTENT = where IN_TIME = '" inTime "'" PreparedStatement PSTMT = conn.preparestatement (SQL); PSTMT.SETCLOB (1, Clob); PSTMT.ExecuteUpdate (); pstmt.close ();} conn.commit (); stat.close (); conn.close () Supplementary sentence
If it is UPDATE, the CLOB field Update in the original database should be EMPTY_CLOB ()
Then update new content by reading the clob of the RS
Reading method
// Read big text string content = ""; oracle.sql.clob x = (Oracle.jdbc.driver.driver.Driver.Dr) result); if ("org_intro"); if (x! = Null) {reader is = x.getCharacterStream (); bufferedreader br = new bufferedreader (IS); string s = br.readline (); while (s! = null) {content = s "/ r / n"; s = br.readline }}
Several Web for reference
http://blog.9cbs.neet/etrew/2003/07/20/17560.aspx
Http://www.newer.com.cn/newer/bbs/topic.asp?topic_id=5270&cat_id=11&Forum_ID=19
Www.itpub.net