public
class lobutil
public
static synchronized void writeblob(resultset rs, string fieldname,
byte buf) throws sqlexception, ioexception
outputstream os = null;
blob b = rs.getblob(fieldname);
if (b == null) else
// else
/*** @todo 需要最終改造為通用資料庫處理介面
*///
try catch (exception e)
// os = ( (oracle.sql.blob) b).getbinaryoutputstream();
// bufferedoutputstream bos = new bufferedoutputstream(os);
bos.write(buf);
bos.flush();
bos.close();}}
public
static synchronized void writeblob(resultset rs, string fieldname,
inputstream in) throws sqlexception, ioexception
outputstream os = null;
blob b = rs.getblob(fieldname);
if (b == null) else
// else
// try catch (exception e)
// os = ( (oracle.sql.blob) b).getbinaryoutputstream();
// bufferedoutputstream bos = new bufferedoutputstream(os);
bufferedinputstream bis = new bufferedinputstream(in);
byte buf = new
byte[buffer_size];
int len = -1;
while ((len = bis.read(buf)) != -1)
bis.close();
bos.flush();
bos.close();}}
public
static synchronized void writeclob(resultset rs, string fieldname,
string buf) throws sqlexception, ioexception
writer wr = null;
clob c = rs.getclob(fieldname);
if (c == null) else catch (exception e)
// wr = ((oracle.sql.clob) c).getcharacteroutputstream();
// bufferedwriter bw = new bufferedwriter(wr);
bw.write(buf);
bw.flush();
bw.close();}}
public
static synchronized void writeclob(resultset rs, string fieldname,
inputstream in) throws sqlexception, ioexception
writer wr = null;
clob c = rs.getclob(fieldname);
if (c == null) else catch (exception e)
//wr = ((oracle.sql.clob) c).getcharacteroutputstream();
//bufferedwriter bw = new bufferedwriter(wr);
bufferedreader br = new bufferedreader(new inputstreamreader(in));
char buf = new
char[buffer_size];
int len = -1;
while ( (len = br.read(buf)) != -1)
br.close();
bw.flush();
bw.close();}}
}
oracle中clob或blob處理
oracle中clob或blob處理 create table document id number 16 not null,content clob null 資料insert處理 try catch sqlexception e catch sqlexception ex finally fin...
Sqoop處理Clob與Blob欄位
author kwu sqoop處理clob與blob欄位,在oracle中clob為大文字,blob儲存二進位制檔案。遇到這類字段匯入hive或者hdfs需要特殊處理。1 oracle中的測試表 create table t lob a integer,b clob,c blob 測試資料 ins...
Sqoop處理Clob與Blob欄位
author kwu sqoop處理clob與blob欄位,在oracle中clob為大文字。blob儲存二進位制檔案。遇到這類字段匯入hive或者hdfs須要特殊處理。1 oracle中的測試表 create table t lob a integer,b clob,c blob 測試資料 ins...