try {
PreparedStatement stmt = Session.connection (). preparestatement (SQL);
ResultSet rs = Stmt.executequery ();
while (Rs.next ())
{
Clob Clob = (Clob) rs.getobject (1);
result = Clobtostring (CLOB);
}
catch (Hibernateexception e) {
E.printstacktrace ();
catch (SQLException e) {
E.printstacktrace ();
catch (IOException e) {
E.printstacktrace ();
finally {
Session.close ();
}
Convert Oracle.sql.Clob type to String type
Public String clobtostring (Clob Clob) throws SQLException, IOException {
String restring = "";
Reader is = Clob.getcharacterstream ();//Get Stream
BufferedReader br = new BufferedReader (IS);
String s = br.readline ();
StringBuffer sb = new StringBuffer ();
while (s!= null) {//execute loop takes all the string out of the value to StringBuffer from StringBuffer to string
Sb.append (s);
s = Br.readline ();
}
restring = Sb.tostring ();
return restring;
}