MyBatis查询CLOB类型数据异常处理

版权声明:本文为博主原创文章,未经博主允许不得转载。如需转载,请在文章的明显处标明本文链接! https://blog.csdn.net/qq_24484085/article/details/85049081

报错

Could not write JSON: No serializer found for class oracle.jdbc.driver.OracleClobReader and no properties discovered to create BeanSerializer

 解决方案(将Clob转String)

// Clob类型 转String
	public String ClobToString(Clob clob) throws SQLException, IOException {
		String ret = "";
		Reader read = clob.getCharacterStream();
		BufferedReader br = new BufferedReader(read);
		String s = br.readLine();
		StringBuffer sb = new StringBuffer();
		while (s != null) {
			sb.append(s);
			s = br.readLine();
		}
		ret = sb.toString();
		if (br != null) {
			br.close();
		}
		if (read != null) {
			read.close();
		}
		return ret;
	}

猜你喜欢

转载自blog.csdn.net/qq_24484085/article/details/85049081