JAVA
clob데이터를 string으로 변경하는 메소드
질주하는구
2015. 8. 26. 16:37
public String clobToString(Object convertData){ if(convertData!=null){ CLOB clobData = (CLOB)convertData; StringBuffer returnStr = new StringBuffer(); try { Reader reader = clobData.getCharacterStream(); char[] buff = new char[1024]; int nchars = 0; while ((nchars = reader.read(buff)) > 0) { returnStr.append(buff, 0, nchars); } }catch (SQLException e) { e.printStackTrace(); }catch (IOException e) { e.printStackTrace(); } return returnStr.toString(); }else{ return ""; } }
반응형