Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: oracle.sql.BLOB.createTemporary(...) throws NullPointerException when used w/ pool

Re: oracle.sql.BLOB.createTemporary(...) throws NullPointerException when used w/ pool

From: Dave Hau <davehau_nospam_123_at_nospam_netscape.net>
Date: Sat, 09 Aug 2003 00:48:41 GMT
Message-ID: <3F3444E8.20508@nospam_netscape.net>


Try the latest 9.2.0.3 JDBC drivers. Also, if you're using the OCI driver, have you tried the thin driver? Does this occur with both?

Bomb Diggy wrote:
> I copied some createTemporaryCLOB code from the technet.oracle.com
> site, hacked it to work for BLOB types instead of CLOBs, then started
> using it in standalone Java programs.
>
> But now I want to use it in a J2EE environment - specifically from a
> servlet. When attempting to do so, however, the call to
> 'createTemporaryBlob()' blows up with a NullPointerException. Any
> ideas?
>
> I'm using, via my WSAD setup, the
> oracle.jdbc.pool.OracleConnectionPoolDataSource for my pool
> 'implementation class'.
>
> My other params are valid, non-null, etc. I figure no method should
> ever throw an NPE... I am only importing oracle.sql.Blob, so there's
> no chance I'm blowing up on trying to execute a method on the null
> java.sql.Blob reference.
>
> I'm using Oracle Client version 9.2.0 and the classes12.jar it ships
> with. Same version for the server.
>
> The reason I've gone the route of using the Oracle BLOB type is b/c I
> need to store large BLOB files into one of my tables via a stored
> procedure - and the [CallableStatement].setBinaryStream(...) doesn't
> work past 32K.
>
> Thanks for any help!
>
>
> private static BLOB getBLOB( Connection conn, byte[] blobData )
> throws Exception
> {
> BLOB tempBlob = null;
> try {
> // next line blows up! NullPointerException!
> tempBlob = createTemporary( conn, true, BLOB.DURATION_SESSION );
> tempBlob.open( BLOB.MODE_READWRITE );
> OutputStream outstream =
> ((BLOB)tempBlob).getBinaryOutputStream();
> outstream.write(blobData);
> outstream.flush();
> outstream.close();
> tempBlob.close();
> } catch ( Exception exp ) {
> tempBlob.freeTemporary( );
> throw exp;
> }
> return tempBlob;
> }
Received on Fri Aug 08 2003 - 19:48:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US