java将clob类型字段转为String

public String clobToString(Clob clob) throws SQLException,IOException{

     String resultString;

    try(

        Reader reader = clob.getCharacterStream();

        BufferedReader br = new BufferedReader(read)

    ){

        String s = br.readLine();

        StringBuilder sb = new StringBuilder();

         while(s!= null){

            sb.append(s);

            s = br.readLine();

        }

            resultString = sb.toString();

    }

    return = resultString;

}

你可能感兴趣的:(java将clob类型字段转为String)