int timeout = 180 * 1000; // 单位毫秒
Response response = Http.post2(innerurl+path, null, timeout);
int len=0;
ByteArrayOutputStream bos=new ByteArrayOutputStream();
while((len=response.getStream().read(buffer))!=-1){
bos.write(buffer,0,len);
}
bos.flush();
buffer = bos.toByteArray();
String condition = "insert into "+table+" ("+key+","+field+",LYID,FOLDERNAME,TYPE,CCWZ) values ('"+id+"',EMPTY_BLOB(),'"+file.getLyid()+"','"+file.getFlodername()+"','"+file.getType()+"','"+file.getCcwz()+"')";
Sql sql = Sqls.create(condition);
daoMiddle.execute(sql);
String condition2 = "select "+field+" from "+table+" where "+key+"='"+id+"' for update";
Sql sql2 = Sqls.create(condition2);
sql2.setCallback(new SqlCallback() {
public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
List<Map> list = new LinkedList<Map>();
while (rs.next()){
pc = (oracle.sql.BLOB) rs.getBlob(1);
OutputStream os = pc.setBinaryStream(1);
try {
os.write(buffer);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return list;
}
});
daoMiddle.execute(sql2);
添加回复
请先登陆