You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by "Mitchell, Cont, J6415, 8292" <ca...@hq.pacom.mil> on 2002/09/13 20:06:24 UTC

village.Record Oracle BLOB Changes

The com.workingdogs.village.Record class that Turbine has doesn't handle
Oracle Blobs over 2000 characters long when you use the Oracle JDBC drivers.
Oracle uses a "LOB locator".  Anything under 2000 characters is stored
in-line with the record, but Blobs over 2000 characters a stored in another
area and pointed to by the locator.  

The Record class uses setBytes().  If you send 2000 characters to the
driver, it works because it's stored with the record; if you send over 2000
characters you get an Ora-01461(?) error.  What you have to do instead is to
insert the record and call a PL/SQL function called empty_blob().  Then you
re-retrieve the record (and you have to record lock it with a "FOR UPDATE"
call) to get the LOB locator.  Now you can stream to it.

I've rewritten the Record class to handle Oracle Blobs.  If anyone wants it,
I can send it over.  It ain't pretty.  I'm forced to import oracle.com.BLOB
and oracle.com.OracleResultSet.  That means that my changes will not compile
unless you have the Oracle JDBC drivers in the classpath.  I'm sure someone
cleverer than I am can refactor it to avoid this.

Oracle's came out with new JDBC drivers in early Sept.  I'm unable to view
the samples.  Supposedly it follows pieces of the JDBC 3.0 specs.  Perhaps
these new drivers solve this problem so this is overcome by events.

Cheers,
Andy