/**
* 将数据库中Clob类型转换成java的String类型
* @param clob
* @return
* @throws SQLException
*/
public static String clobtoString(Clob clob) throws SQLException {
StringBuffer str = new StringBuffer();
if (clob == null) {
return null;
}
Reader reader = null;
try {
reader = clob.getCharacterStream();
char ac[] = new char[200];
int i;
while ((i = reader.read(ac, 0, 200)) != -1) {
str.append(new String(ac, 0, i));
}
} catch (Exception exception1) {
throw new SQLException(exception1.getMessage());
} finally {
try {
reader.close();
} catch (Exception _ex) {
}
}
return str.toString();
* 将数据库中Clob类型转换成java的String类型
* @param clob
* @return
* @throws SQLException
*/
public static String clobtoString(Clob clob) throws SQLException {
StringBuffer str = new StringBuffer();
if (clob == null) {
return null;
}
Reader reader = null;
try {
reader = clob.getCharacterStream();
char ac[] = new char[200];
int i;
while ((i = reader.read(ac, 0, 200)) != -1) {
str.append(new String(ac, 0, i));
}
} catch (Exception exception1) {
throw new SQLException(exception1.getMessage());
} finally {
try {
reader.close();
} catch (Exception _ex) {
}
}
return str.toString();
}
private void mian() {
//map为数据库信息
String content_xml = StringUtil.clobtoString((Clob)map.get("content_xml"));
}