You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Arthur Chan <ac...@saysit.com> on 2002/09/29 18:31:44 UTC

JAVA accessing Ora CLOB's and BLOB's

Hi All.
This is a bit out of context, please do not take offence.
I managed to stream documents of various docFlavour into and out of BLOBs e.g .doc, .gif, .jpg etc but have difficulties getting Ora's CLOB to write the content from the database to a file. Both BLOB and CLOB fields are in the same db record !
It is the simplest text file, just a few lines. I inserted following codes for sanity checks...
...
// get the row containing the LOB locator
ResultSet clobResultSet = thisStatement.executeQuery
( "SELECT ATxtMsg "+ 
  "FROM ... " +
  "WHERE..."
);
clobResultSet.next();
CLOB thisClob = ((OracleResultSet) clobRS).getClob("ATxtMsg");
int chunkSize = thisClob.getChunkSize();
System.out.println("chunkSize is " + chunkSize);
...
The outputs are :
chunkSize = 8132 (this is the default, and a good one at that...)
clobLength = 0 (it most certainly is not...)
Read clob and saved file /home/arthur/...../TargetFolder/retrievedCLOB_test.txt

BUT the text file in targetDirectory is empty !?!
Where could I have gone wrong - this is the simplest case ?