카테고리 없음
CLOB -> String으로 변환
eqzero
2006. 12. 7. 00:48
오라클의 대용량데이터 처리를 위해 CLOB 컬럼을 만들었고 후에 뷰페이지인 JSP에서 내용을 뿌려줄때 약간의 변환이 필요하다
물론 방법이야 많겟지만 아파치의 common.dbutils를 사용할때는 아래 메소드를 사용하는게 좋다(-_-;).
======================================================================
public static String clobToString(CLOB clob) throws Exception {
StringBuffer s = new StringBuffer();
BufferedReader br = new BufferedReader(clob.getCharacterStream());
String ts = "";
while((ts = br.readLine()) != null) {
s.append(ts + "\n");
}
br.close();
return s.toString();
}
물론 방법이야 많겟지만 아파치의 common.dbutils를 사용할때는 아래 메소드를 사용하는게 좋다(-_-;).
======================================================================
public static String clobToString(CLOB clob) throws Exception {
StringBuffer s = new StringBuffer();
BufferedReader br = new BufferedReader(clob.getCharacterStream());
String ts = "";
while((ts = br.readLine()) != null) {
s.append(ts + "\n");
}
br.close();
return s.toString();
}