Hi,
The snippet I sent earlier has a bug while writing to the file, so
please ignore that.
Here is the fixed one.
Example: Getting the AsciiStream from the clob column and writing it to
a file
InputStream is = rs.getAsciiStream(2);
BufferedInputStream bs=new BufferedInputStream(is);
FileOutputStream fo=new FileOutputStream("asciiClob"+i+".txt");
int numread=0;
byte[] buff = new byte[128];
while (true) {
numread = bs.read(buff);
if (numread<0) break;
fo.write(buff,0,numread);
}
fo.close();
bs.close();
Regards,
Rajesh
Rajesh Kartha wrote:
Daniel Noll wrote:
Hi.
Are there any known problems in Derby 10.1 with regards to retrieving
CLOBs? We have a system which can work in both embedded and client
mode, and I've discovered that using it in client mode results in an
empty string (not null, but "") returned for a CLOB-type column.
The same issue doesn't happen on the embedded driver, and I can't
find any immediately obvious records in JIRA which describe a similar
problem.
Daniel
Hi Daniel,
Can you post the way you are retrieving the CLOBs from the ResultSet.
I have used the rs.getAsciiStream() and rs.getCharacterStream()
methods for getting CLOBs in the past (with the Client driver) and it
seemed to work just fine.
Example: Getting the AsciiStream from the clob column and writing it
to a file
InputStream is = rs.getAsciiStream(2);
BufferedInputStream bs=new BufferedInputStream(is);
FileOutputStream fo=new
FileOutputStream("asciiClob"+i+".txt");
byte[] b=new byte[128];
while ((bs.read(b))>0){
fo.write(b);
}
fo.close();
bs.close();
-Rajesh