Read large object data in Java

xiaoxiao2021-03-06  83

/ **

* Extract the contents of the CLOB type field from the database and convert to a string

* @Param RS Database ResultSet, a field containing a clob type

* @Param Clobidx Index in the RESULTSET with a CLOB Type field

* @Return takes out character content

* @Throws SQLException

* /

Public Static StringBuffer getClobcontent (ResultSet RS, INT Clobidx) THROWS SQLEXCEPTION

{

Log.debug ("Start getting Clob content, index =" clobidx);

Oracle.sql.clob Clobfield = ((ORACleResultset) RS) .getClob (Clobidx);

Long clen = clobfield.length ();

Char clobarray [] = new char [(int) Clen];

Int ReadedNum = Clobfield.getChars (1, (int) Clen, CloBarray);

StringBuffer SB = new stringbuffer ();

Sb.append (CloBarray);

Log.debug ("The read version is [/R/N" sb.tostring() "] ");

Return Sb;

}

转载请注明原文地址:https://www.9cbs.com/read-106337.html

New Post(0)