81,092
社区成员
发帖
与我相关
我的任务
分享
byte[] temp_bytes= rs.getBytes("字段名");
----------------转换
String contentString="";
try {
if(bytes!=null && !bytes.equals("")){
contentString = new String(bytes, "gb2312");
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return contentString;
public String ClobToString(Clob clob) {
String reString = "";
Reader is = null;
try {
is = clob.getCharacterStream();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 得到流
BufferedReader br = new BufferedReader(is);
String s = null;
try {
s = br.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StringBuffer sb = new StringBuffer();
while (s != null) {
//执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
sb.append(s);
try {
s = br.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
reString = sb.toString();
return reString;
}