由于项目的需要.用到了大字段Clob.以下是读取方法
第一种:
Clob clob = rs.getClob(“remark”);//java.sql.Clob
String detailinfo = “”;
if(clob != null){
detailinfo = clob.getSubString((long)1,(int)clob.length());
}
第二种:
Clob clob = rs.getClob(“remark”);//java.sql.Clob
int i = 0;
if(clob != null){
InputStream input = clob.getAsciiStream();
int len = (int)clob.length();
byte by[] = new byte[len];
while(-1 != (i = input.read(by, 0, by.length))){
input.read(by, 0, i);
}
detailinfo = new String(by, “utf-8″);
}