• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.sql.SQLException: ORA-01407:

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your help !

Your thread was greatly helpfull.
 
reply
    Bookmark Topic Watch Topic
  • New Topic