File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes inserting blob with CMP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "inserting blob with CMP" Watch "inserting blob with CMP" New topic

inserting blob with CMP

marc de toutophone

Joined: Jul 16, 2003
Posts: 4
i'm using oracle database 9iAs and
oc4j application server.
in my application, i need to insert
a blob in the database.
the ejb entities is a cmp.
i implement the blob interface
but when i use setBlob(Blob b)
i have no error but the blob in
the database is null.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
toutophone toutophone,
Thanks for joining JavaRanch, but could you take a quick look at the naming policy and edit your profile accordingly.
Now about your question...
First you will want to check to make sure your Application Server supports Blobs in CMP. Then you will need to read up on how this mapping is implemented (for example WebLogic maps Blobs to byte arrays). Basically, this is going to be a vendor specific extension. Since you are using Oracle AS, I am going to move this post to the Oracle/OAS Forum for further discussion.
Sujatha Ranganathan

Joined: May 29, 2003
Posts: 12
You cannot use Blobs directly as fields in CMP EJB, since Blob is really an open cursor to the database, and it is not serializable.
Here's a How-to on using Blobs
You can see the code for this at the end of the page
Hope this helps,
marc de toutophone

Joined: Jul 16, 2003
Posts: 4
thanks for your help
i try to insert the blob, there is no
error messsage, so i think its ok
but there is no blob in table.
did you have the same probleme?
I agree. Here's the link:
subject: inserting blob with CMP
It's not a secret anymore!