try{
  String sql = "";
        sql = "SELECT content  "
         + "FROM t_inf01_additioninfo "
         + "WHERE id = " + String.valueOf(id) ;      rs = conn.executeQuery(sql);
    
if (rs.next()){
Reader clob = rs.getCharacterStream(1);
BufferedReader br = new BufferedReader(clob);
                String s = br.readLine();
                while (s != null) {
                  scontent += s;
                   s = br.readLine();
                }
}
} catch (Exception ex) {
     ex.printStackTrace();
} finally {
rs.close();
     conn.close();
     conn=null;
}

解决方案 »

  1.   

    public static String getClob(Clob clo){
        BufferedReader reader = null;
        StringBuffer datastr =null;
        try {
          if (clo != null) {
    reader = new BufferedReader(clo.getCharacterStream());
    String data = null;
    datastr = new StringBuffer();
    try {   while ( (data = reader.readLine()) != null)
        datastr.append(data).append('\r').append('\n');
    }
    catch (IOException ex) {
      System.out.println(ex);
    }
    finally {
      try {
        reader.close();
      }
      catch (IOException ex) {}
    }
          }
          else
    return "";
        }
        catch (SQLException ex) {}
        return datastr.toString();
      }