SSISO Community

시소당

자바에서 blob 연동

1.  일단  ResultSet를  가져온다.
rset  =  stmt.executeQuery  ("select  col_blob,  col_clog  from  lob_table  where  id  =  100");
rset.next  ()
2.  lob  locator를  확보한다.
BLOB  blob  =  ((OracleResultSet)rset).getBLOB  (1);
CLOB  clob  =  ((OracleResultSet)rset).getCLOB  (2);
3.  blob에서  데이타를  꺼내온다.
InputStream  in  =  blob.getBinaryStream();
byte[]  buffer  =  new  byte[10];
int  length  =  0;
while  ((length  =  in.read(buffer))  !=  -1)
{
for  (int  i=0;  i<length;  i++)
---  읽어온  값을  처리한다..
}
in.close();

출처  :  http://www.okjsp.pe.kr/seq/26

653 view

4.0 stars