File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes java.sql.SQLException: ORA-01407: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: ORA-01407:" Watch "java.sql.SQLException: ORA-01407:" New topic
Author

java.sql.SQLException: ORA-01407:

Surya Ram
Greenhorn

Joined: Aug 09, 2004
Posts: 7
Hello,
I am updating the BLOB in Oracle and using setBinaryStream(1,stream,length)
I get the following error. It happens in some cases only....

---java.sql.SQLException: ORA-01407: cannot update ("SCHEMA"."BLOB"."BLOB") to NULL

here is the code I used to get the stream
********************************
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
ObjectOutputStream objStream = new ObjectOutputStream(byteStream);
objStream.writeObject(obj);
objStream.flush();
System.out.println("objStream"+objStream.toString());
System.out.println("byteStream-------------------"+byteStream.toString());
byte[] byteArray = (byte[])(byteStream.toByteArray());
ByteArrayInputStream stream = new ByteArrayInputStream(byteArray);
Lisa D'Aniello
Ranch Hand

Joined: Sep 25, 2003
Posts: 42
Hi Surya,

I think you are missing a couple of steps, and maybe have a couple backwards (or maybe you didn't post all of your code???). I cannot see where you are defining your blob locator, nor the information that you plan on sending.

If you could post all of your code that pertains to the blob, I bet we could get you up and running in no time!
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Here is some code I found on Sun's forum, commented with step-by-step instructions:

You need to import part of the oracle.sql package.

I hope this helps.

Jules
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1132

Surya,
Pardon me if I am stating the obvious, but according to the error message you have posted, column BLOB, in table BLOB, owned by user SCHEMA is a mandatory (or "not null") column, and you are trying to set it to null.

Good Luck,
Avi.
pascal monfils
Greenhorn

Joined: Aug 09, 2004
Posts: 9
thanks for your help !

Your thread was greatly helpfull.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: ORA-01407: