Home » Developer & Programmer » JDeveloper, Java & XML » Different Size CLOB
Different Size CLOB [message #92106] Wed, 10 March 2004 23:01 Go to next message
Messages: 7
Registered: November 2001
Junior Member
Goodmorning experts,
i have a big problem, and since two days that i'm not able to resolve it.
i'm copying the content of a XML file into a CLOB. The problem is that at the end of the steps, into the CLOB field i have all structure but more of the original file. I don't know the cause.
I put under the message a little code lines. Please can you help me.. My head is crazying. Thank you so much.
Regards Gianni
//*************Insert Value CLOB field ************
CLOB clob=((OracleResultSet)rs).getCLOB("FileXML");
final File fclob = new File(fileXML);
is = new FileInputStream(fclob);
final byte[[]] bufCLOB=new byte[[clob.getBufferSize()]];
bytesRead = 0;
while((bytesRead = is.read(bufCLOB)) != -1) {
for (int i=0; i<bufCLOB.length;i++){
Re: Different Size CLOB [message #92120 is a reply to message #92106] Tue, 16 March 2004 21:50 Go to previous message
Messages: 2
Registered: March 2004
Junior Member
Try as Follows:

I am collecting the content from clob into Temporary file.
Just Modify the code as you want.
private String writeToFileReader(Clob clob)
String line, str = "";
File tmpFile = null;
tmpFile = File.createTempFile("tmpDesc","xml");

BufferedReader reader = new BufferedReader(clob.getCharacterStream());
//FileWriter writer = new FileWriter(tmpFile);
while((line = reader.readLine()) != null)
str += line;
OutputStream outStream = new FileOutputStream(tmpFile);
OutputStreamWriter out = new OutputStreamWriter(outStream,"UTF8");
// close all the stream
}catch(IOException e)
System.out.println("IOException..from writeToFileReader.."+e.toString());
}catch(SQLException se)
System.out.println("SQLException..from writeToFileReader.."+se.getMessage());

if(tmpFile.length()!= -1)
return tmpFile.getPath();
return "File NOt Found" ;
Happy coding
Previous Topic: Tcp Packet monitor Problem
Next Topic: jdbc connecting oracle jdbc driver
Goto Forum:

Current Time: Fri Dec 09 20:12:13 CST 2022