Blob field using cmp

Hi ,
I need to retrieve the blob data stored in oracle 9i database.
I am using studio 5 to create a CMP using which the blob field gets mapped to java.io.Serializable class. Oracle thin driver is used and an image of size 1 kb is stored in the table.
When the client (servlet) calls the method to get the contents of the blob field, the following exceptions are thrown :
com.sun.jdo.api.persistence.support.JDOFatalDataStoreException: IOException reading serializable object from byte array.
NestedException: java.io.StreamCorruptedException: invalid stream header
     at com.sun.jdo.spi.persistence.support.ejb.cmp.JDOEJB11HelperImpl.readSerializableObjectFromByteArray(JDOEJB11HelperImpl.java:340)
     at orclblobfolder.orclejb.orclblobBean_1927863344_ConcreteImpl.getImage(orclblobBean_1927863344_ConcreteImpl.java:177)
     at orclblobfolder.orclejb.orclblobBean.getBlobImage(orclblobBean.java:84)
     at orclblobfolder.orclejb.orclblobBean_1927863344_ConcreteImpl_EJBObjectImpl.getBlobImage(orclblobBean_1927863344_ConcreteImpl_EJBObjectImpl.java:22)
     at orclblobfolder.orclejb._orclblobBean_1927863344_ConcreteImpl_EJBObjectImpl_Tie._invoke(Unknown Source)
     at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:569)
     at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:211)
     at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:113)
     at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:275)
     at com.sun.corba.ee.internal.iiop.LocalClientRequestImpl.invoke(LocalClientRequestImpl.java:96)
     at com.sun.corba.ee.internal.corba.ClientDelegate.invoke(ClientDelegate.java:237)
     at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOAClientSC.java:97)
     at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
     at orclblobfolder.orclejb._orclblob_Stub.getBlobImage(Unknown Source)
     at orclblobfolder.orclejb._orclblob_Stub.getBlobImage(Unknown Source)
     at test.processRequest(test.java:67)
     at test.doGet(test.java:127)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
     at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
     at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
     at java.security.AccessController.doPrivileged(Native Method)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
     at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
     at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
snippet of bean class is :
public abstract java.io.Serializable getImage();
public abstract void setImage(java.io.Serializable image);
public java.io.Serializable getBlobImage() {
//method which client calls
return getImage();
Similar exceptions are thrown when I use poinbase wherein blob data is mapped to byte[] instead of java.io.Serializable.
Please let me know how can I resolve this problem.
Thanks a lot,
-Amol

How does it effect, when the blob data is stored indatabase using an external source
The current CMP implementation assumes that a serializable field is stored by serializing it to a byte[] and then storing the byte[] as blob. while retrieving the data, it always tries to de-serialize the byte[] in to a serializable field. Hence if you have stored the data externally, it would fail with "JDOFatalDataStoreException: IOException reading serializable object from byte array."
Thanks,
Mitesh

Similar Messages

  • Downloading data from a BLOB Field using mod_plsql

    Hi,
    I am trying to use the mod_plsql to download data from a blob field, I have a web page where I can pick the file name to be downloaded from the documents table This table has the BLOB field that has the Data formatted in a text file format(contains carriage returns), when I open it up in the browser it is displaying it correctly , but when I right click on the file name and choose "Save Target As" and save it as text file it is ignoring the carriage returns and displaying entire blob in one line.
    Can somebody help me figure out why it's not recognizing the carriage returns?
    Any help would be greatly appreciated.
    Thanks

    Hi and welcome to the forum.
    Is there a way to retrieve data from a blob field and save it to temp table.Why would you want to do that?
    Can you provide some more details regarding your requirement?
    (Don't forget to mention your database version as well)
    Also, I wonder why you've added a 'decompress' tag to your question?
    edit, after seeing Tubby's reply
    Dang, the connection must be frozen here ;)
    Edited by: hoek on Jan 6, 2010 9:06 PM

  • Insert/update image in Database from C:\ drive, In BLOB Field using PL/SQL

    is Any Body have a experience of Image file Saving, updating and getting from Table, i want to save it in Database not in any Folder or Link, its Urgent! i want to insert image in Table having BLOB field from C:\test.jpg

    Try the following link, some useful material :-
    http://www-rohan.sdsu.edu/doc/oracle/server803/A50580_2/img_uses.htm

  • Problem with ojdbc14.jar (oracle10g Rel. 2 driver) in updating a BLOB field

    Hello All,
    Our web application uses oracle10g Release 2 jdbc driver with websphere 5.1.1.4 and oracle 9i. When it tries to update a BLOB field in the database updation is successful but it is updating that field with a null value. So rest of our application fails as this value is becoming null. We use an entity bean to update this table and websphere uses a prepared statement to update this table. Just before setting this BLOB field using setBinaryStream() on prepared statement I am printing to see whether it is null or not as shown in the code snippet below. And it is printing it correctly as non null. But after execution of the prepared statement some how the value stored in database is null.
    Is this a known issue with this driver? Does any one know work around or a solution to this? We have 3 BLOB fields in that table. Is that a problem? If we separate these BLOB fields into separate tables will the problem be solved? Any input on this is very much appreciated.
    // For column ORIGINAL_CONTENT
    byte[] tempbyteArray;
    tempbyteArray=(byte[])inputRecord.get(25);
    if (tempbyteArray == null) {
    System.out.println("DqPageBeanFunctionSet_f9c724af: tempbyteArray NULLLLLLL");
    } else {
    System.out.println("DqPageBeanFunctionSet_f9c724af: orig tempbyteArray length: " + tempbyteArray.length);
    if(tempbyteArray != null) {
    pstmt.setBinaryStream(25,new java.io.ByteArrayInputStream(tempbyteArray),tempbyteArray.length);
    else pstmt.setNull(25,java.sql.Types.BLOB);
    Thanks & Regards,
    -Sunitha

    I have similar problem and I solved it using ojdbc14.jar oracle9i version.
    try...

  • Persist large field using stream in JPA 2.0

    Is it possible persist a blob field using a stream?
    I want persist a long file in a database and i wan not load it in a byte[] in memory. I wan use a stream, as a Blob in jdbc.
    Thanks a lot.

    Hi,
    I assume that your requirement is to persist the long file in to database using the byte[].You can load the blob type as byte[].
    You need to annotate the field in a entity @lob as given below.
    public class Person implements Serializable {
    @Id
    @Column(nullable = false, length = 20)
    private String name;
    @Column(nullable = false)
    @Lob
    private byte[] picture;
    @Column(nullable = false, length = 20)
    You can set the byte[] on picture as given below.
    Person p=new Person();
    p.setName("Tom");
    p.setSex("male");
    p.setPicture(byte[]).//read the file contents and create a byte[] and set it on entity field and persit the entity.
    please find the full descriptionof the above example in the below link.
    http://weblog.oraclecorp.com/weblog/team/AppDevToolsTivve/2010/08/using_jpa_to_insert_and_retrieve_blob_and_clob_types.html.
    Hope this helps.
    Regards,
    Vinay

  • ORA-00932 (Inconsistent datatype) on BLOB field in Forms 6i

    My query is failing with an ORA-00932 when I'm trying to display a blob field using an image type in Forms. It worked fine under 8.1.7DB and now under 9.0.1 it's a problem. It's only a problem when the form is web deployed (using ListenerServlet).
    Any clues?????
    Thanks in advance.

    Bert,
    Im trying to get a 8i blob image into a non-web form Image Item and have had no luck for days. Can you help?
    Dan

  • BLOB field in Entity CMP EJB (DB = Oracle)

    I use Borland App Server 4.5.1 .
    I have table, which has BLOB column.
    My first question is:
    What datatype should corresponding field in Entity CMP EJB have?
    I set it to byte [].
    When I deal with BLOB data of small size, everything is OK.
    But when the size of BLOB data is few larger,
    when I insert new record
    an Oracle error happens: a sort of
    "TNS adapter error: end of communication chanel"
    I use thin jdbc-driver.
    So does anybody have an experience in working with BLOB field in Entity CMP EJB (DB = Oracle) ?
    may be, the solution is to write BMP fields in Entity EJB,
    i.e. to write own methods
    set[BLOB_COLUMN](...),
    get[BLOB_COLUMN]() ?
    Thank you for answers.

    I have tried with db2 7.1/ IAS 4.0 and it works fine
    I use Borland App Server 4.5.1 .
    I have table, which has BLOB column.
    My first question is:
    What datatype should corresponding field in Entity CMP
    EJB have?
    I set it to byte [].this is perfect
    When I deal with BLOB data of small size, everything
    is OK.
    But when the size of BLOB data is few larger,
    when I insert new record
    an Oracle error happens: a sort of
    "TNS adapter error: end of communication chanel"In db2 there is a max size limit on the blob column. please check if such limit for oracle database.
    >
    I use thin jdbc-driver.
    So does anybody have an experience in working with
    BLOB field in Entity CMP EJB (DB = Oracle) ?
    may be, the solution is to write BMP fields in Entity
    EJB,
    i.e. to write own methods
    set[BLOB_COLUMN](...),
    get[BLOB_COLUMN]() ?this is a good approach
    >
    Thank you for answers.Regards,
    -- Ashish

  • How to store file content in BLOB field MySql database using java

    Hi!
    i want to store the file content in a BLOB field in MySql database using java.
    Please help me out..........
    thanx in advance...
    bye

    i stored images in db, and retrieved them. like that cant i store pdf file in db, and retrieve it back using oracle db?
    Plz help me out how to put a file in db. i need complete code. thanks in advance.

  • Can we use BLOB fields (that store images) in Crystal Report ?

    I'm developing with ASP.NET, VS.NET 2003.
    Using Crystal Report for VS.NET
    DataBase: Oracle 10g
    I store a BLOB field in a table. This field store images, like jpg files.
    The Stored Procedure that I use to fill the report is:
    OPEN MyCursor FOR
    SELECT MyId , MyImg
    FROM MyTable
    MyImg is BLOB field
    However, when I try to use the stored procedure in Crystal Report at design mode, any field can be displayed and then drag and drop to the report, but MyImg is not possible.
    There is an error message:
    Details: ADO Error Code: 0x80004005
    Source: Microsoft OLE DB Provider for Oracle
    Description: Data type is not supported
    I'm afraid that is not so easy for me to change DB connector drivers.
    My question is:
    - Is it possible to use BLOB fields in Cyrstal Reports?
    - Or should I convert them previously to something, so they can be displayed in Crystal Report at desing mode ?
    - If I should change DB connector drivers, which one should I use and from where should I download it and then install it in my Web Server?
    Thank you very much!

    Hi,
    I dont know much at all about CR, but I do know Microsoft's OLEDB Provider for Oracle doesnt support Blob datatype.. http://support.microsoft.com/kb/q244661/
    Oracle's OLEDB provider does though, you can get it as part of the ODAC download on OTN.
    Hope that helps,
    Greg

  • How can i use a blob field in a formula field object

    Hi ,
    We are using Crystal Report Server XI R2.  i have a field "ANSWER" in my datasource which stores value 1 or 0.
    And i have table to store two images as blob fields are "EVALTICKIMAGE" and "EVALCROSSIMAGE".
    Now i need to show an image in my report for the field "ANSWER" instead of 0 or 1.
    So i written a formula to achieve this. my formula text is follows:-
      oFormulaField.Text = @"if {CSP_PROCESS_REPORT.ANSWER} = ""1"" then {EVALIMAGE.EVALTICKIMAGE} else {EVALIMAGE.EVALCROSSIMAGE} ";
    but this does not works for me. i recieve an error "A blob field cannot be used in a formula".
    is there any other way to show images based on a condition.
    or is that possible to use blob fields formulafield, kindly help me.
    Thanks,
    Padmanaban V

    You can use conditional suppression instead.
    Place both image fields on the report. Right click the 1st image field (EVALIMAGE.EVALTICKIMAGE) and choose Format Graphic and make sure the Format Editor is on the Common Tab.
    Click the x-2 button across from Suppress and enter the following formula:
    IF({CSP_PROCESS_REPORT.ANSWER} = 1 THEN FALSE ELSE TRUE
    For EVALIMAGE.EVALCROSSIMAGE, do the same thing except change the formula to:
    IF({CSP_PROCESS_REPORT.ANSWER} = 0 THEN FALSE ELSE TRUE
    Once that's done, you can set one image directly on top of the other.
    HTH,
    Jason

  • Problem w/ image item using 9i BLOB field and InterMedia ORDImage Object

    Hi,dear all,
    I have a problem with image item in Form 6i. Oracle 9i is used as backend DB, and a table contains image data is created for testing:
    create table image_test(
    id number,
    image blob
    In Form 6i, there is no problem to create a block for inserting/updating the image record into the database. However, it can not be used to retrieve image (blob field), the image item remains empty after 'execute query', while the id field can be retrieved. When the same table is created in Oracle 8.1.7, and the exact same form can be used without any problem both in inserting and retrieval. It seems that the Oracle 9i does not use the same way to store BLOB column. Has anybody ever encountered this problem? How to retrieve image (BLOB) in Form 6i from Oracle 9i?
    I tried to use interMedia ORDImage as the data type in Oracle 9i, that is,
    create table image_test(
    id number,
    image ORDSYS.ORDImage
    Same problem, the form can insert record with image, but when retrieving, nothing displayed. Anybody could help! Thanks in advance!

    hi!
    well working with oracle8i and form6i.
    same problem..but i used (instead of blob or clob as datatype..) Long raw..
    it can be saved as usual..i mean Commit..
    and can be retrieved..using Execute_Query..its working fine..
    well if anybody get any other solution..do inform..
    mail_id:
    [email protected]

  • How to retrieve the data stored in BLOB field in MySql using java?

    Hi all!
    i stored a file content into the MySql database in BLOB field.
    and i now want retrieve the data......
    Please help me out in doing the task...........
    Thanx...........

    Thrisha..
    When u get a result set u can have rs.getBlob() function that will give u a BLOB object that can be captured using Blob interface of javax.sql package...
    Blob interface has getBinaryStream, getBytes etc as functions...
    i think i cleared u
    regards
    Shanu

  • Problem building a trigger using a BLOB field in Oracle 10

    My case is the following,
    I'm trying to implement an AFTER trigger which uses the :new.blob_field to insert the new value in a table. Because of the documented AFTER restriction and :new use for blob fields, I've though to add other BEFORE trigger that calls a procedure in which I can store the :new value and later insert the temporary value in the table when the AFTER trigger is executed.
    The Idea is the following:
    BEFORE trigger :new -> TEMP
    and then
    AFTER trigger uses TEMP to store in the new table
    So, the final questions are the following:
    -Any other idea to do the same, that is, to use the ":new" value in an AFTER trigger?
    -How can I do this with the temp variable, is this correct?:
    PROCEDURE store_blob ( new_val BLOB ) IS
    BEGIN
    DBMS_LOB.CREATETEMPORARY(new_blob_temp,TRUE, DBMS_LOB.SESSION);
    -- fill with data
    DBMS_LOB.COPY (new_blob_temp,new_val,DBMS_LOB.GETLENGTH(new_val),1,1);
    END store_blob ;
    Because of the design of the application I have to use the AFTER trigger to store the new value so I must find a solution for this type of fields.
    Sorry for the size of the text and also for my english.
    Thanks in advance

    SQL> create or replace trigger trg1 after insert on test_blob for each row
      2  begin
      3  insert into test_blob2 values (:new.a);
      4  end;
      5  /
    Trigger created.
    SQL> insert into test_blob values ('123456789');
    1 row created.
    SQL> desc test_blob;
    Name                                      Null?    Type
    A                                                  BLOB
    SQL> desc test_blob2
    Name                                      Null?    Type
    A                                                  BLOB
    SQL>
    SQL> select dbms_lob.getlength(a) from  test_blob2;
    DBMS_LOB.GETLENGTH(A)
                        5

  • Show photoes using blob field in Oracle DB

    When create Crystal report using Blob field in Oracle 10g DB, the photoes are tif format stored in blod and there are multipages for every record. However in the Crystal Report,it just show the first page of the photo.
    Are there some ways to display all the pages? Or is it necessary to programming using java or .net to display?

    Not capable. CR will only show the first picture and not an album.

  • Weblogic and cmp with blob fields

    I have an entity bean with cmp. This bean has a blob field. When ejbCreate and
    ejbPostCreate methods are executed in this bean, exception saying "row containing
    the LOB value is not locked" is thrown.
    The transaction attribute for the method is set to RequiresNew in the deployment
    descriptor.
    Can someone suggest what may be going wrong here.
    Thanks

    I have an entity bean with cmp. This bean has a blob field. When ejbCreate and
    ejbPostCreate methods are executed in this bean, exception saying "row containing
    the LOB value is not locked" is thrown.
    The transaction attribute for the method is set to RequiresNew in the deployment
    descriptor.
    Can someone suggest what may be going wrong here.
    Thanks

Maybe you are looking for

  • ME29N - Self release of P/O's

    We are trying to prevent P/O's being released by the person who created it (in 4.7). Using user exit EXIT_SAPLEBND_002 we can output an error message - but if the project containing this component is active it appears to prevent us from creating a re

  • About DAQ task and writing to a line

    Hi all,   I swtich from Labview to Labwindows and switch from traditional DAQ to DAQmx. I have two questions about using the DAQmx. Based on the example from NI, I write a function for a single sample output to a single digitial line void WriteLine(i

  • Mac OSX 10.9.4 - Can't find smugmug add-on zip file for LR

    I want to add a published service for smugmug onto LR and for the life of me I can't find it in my downloads folder.  I logged into creative cloud and have syncing on and made sure it is in the correct folder.  I made sure creative cloud is pointed t

  • FRM-41072:Can't create Group (for a tree)

    Hello, the following code is trying to refresh data while saving the record which is a child of the child of the Grand parent. In Key-commit Trigger.. The Query was working just fine without the new modification concept to have a child from the child

  • IWeb and Explorer

    I'm a teacher and I use IWeb to create a class Website. http://web.me.com/socialstudies8/SullivanClasswebsite/MrSullivansWebSite.html I've been using iWeb to publish my site since 2006 and never had a problem. My school has all Dell Desktops and Lapt