>

29 marzo 2009

Covertir un CLOB a String (java oracle)

Os dejo este pedacito de código que convierte un CLOB de oracle a un String:

private
String CLOBToString(CLOB cl) throws IOException, SQLException

{
if (cl == null)
return "";
StringBuffer strOut = new StringBuffer();
String aux;
BufferedReader br = new BufferedReader(cl.getCharacterStream());
while ((aux=br.readLine()) != null)
{
strOut.append(aux);
}
return strOut.toString();
}

3 comentarios:

Anónimo dijo...

te voy a coger el fuente, si no te importa. gracias por la aportacion :)

Anónimo dijo...

Me ha venido increíblemente bien, ¡gracias!

Unknown dijo...

gracias!!