將Clob對象轉換成String對象
/**
* 將Clob對象轉換成String對象
* @param clob
* @return
* @throws SQLException
* @throws IOException
*/
public static String ClobToString(Clob clob) throws SQLException, IOException{
String str="";
Reader reader=clob.getCharacterStream();//得到流
BufferedReader bReader=new BufferedReader(reader);
String s = bReader.readLine();
StringBuffer strBuffer = new StringBuffer();
while(s!=null){//執行循環將字符串全部取出附值給StringBuffer由StringBuffer轉成String
strBuffer.append(s);
s=bReader.readLine();
}
str=strBuffer.toString();
return str;
}