Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: ORA-01407:

 
Surya Ram
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help !

Your thread was greatly helpfull.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic