When I first did not know how to store the string type to the clob type, I felt very troublesome. I had to turn a lot of information online and there was not much reference value.
Fields stored in the database are of the clob type. to store the string type to the clob type, you must first convert the string type to the stream type, and then store the stream, it's not hard
String description = "store string type to clob type! ";
Stringreader strreader = new stringreader (description );
Use stored procedures for storage:
Callablestatement logcs = con. preparecall ("{call insert_test_case_import_log (?,?,?,?,?, ?,?,?)} ");
Try {
Logcs. setstring (1, projectid );
Logcs. setstring (2, importlogid );
Logcs. setstring (3, Creator );
Logcs. settimestamp (4, mystamp );
Logcs. settimestamp (5, endtime );
Logcs. setstring (6, filename );
Logcs. setstring (7, filetype );
Logcs. setcharacterstream (8, strreader, strdescription. Length ());
Logcs.exe cute ();
} Catch (sqlexception e ){
E. printstacktrace ();
} Finally {
Logcs. Close ();
}
Java timestamp processing: The following example is not described in detail.
Date finishtime = new date ();
Calendar finishcalendar = calendar. getinstance ();
Finishcalendar. settime (finishtime );
TimestampEndtime= New timestamp (finishcalendar. gettimeinmillis ());