Skip to Content

JAVA API: Problem for insert Binary Object

Hi guru,

I have a problem for insert a document (word,excel,txt and so on...) in Binary Object table (use a MDM 5.5 SP4 fix 2) with Java Api.

this is my code:

<b>A2iFields flds = new A2iFields();</b>

//add data_ID

<b>flds.Add(new A2iField("Data_ID", new Value(myDataId)));</b>

//adding the "DataGroupId"

// I have only one data group

<b>flds.Add(new A2iField("Data_Group_ID", new Value(1)));</b>

//adding the name

<b>flds.Add(new A2iField("Name", new Value(myName)));</b>

//adding the Original Name

<b>flds.Add(new A2iField("Original_Name", new Value(myOriginalName)));</b>

// adding Description

<b>flds.Add(new A2iField("Description", new Value(myDescr)));</b>

//the name of Binary Object table is :"Binary_Object"

<b>int newImageId = repData.AddRecord("Binary_Object", flds, 0, 0)</b>

This code return always this error:

<b>ERROR e.GetErrorCode()=-5586944 STRINGEXCEPTION_MSG= e.message=AddRecord error a2i.core.StringException: AddRecord error</b>

I found in this forum this thread Image upload using Java API and I set the propeties of the Mdm repository:

<i>"....

Right-Click on the Repository and select Properties...

In this window change the value of the following:

Allow invalid images -> Yes

You may first have to change the setting Prohibit Photoshop Images -> No

...

"</i>

But my code goes always in error.

Can someone help me?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2007 at 01:07 PM

    Hi Rocco,

    There are a few fields that are mandatory while inserting data in the Binary Object table.

    1. <b>Data ID</b>: wherein data in <b>Bytes</b> is provided

    2. <b>Data Group ID</b>: Provides the Data Group ID in which the Binary Object will be stored

    3. <b>Name</b>: Name to be assigned to the object

    4. <b>Original Name</b>: Original File Name

    5. <b>Original Location ID</b>: This is the ID of the Binary Object in the <b>Data Location Table</b>.(Internal to MDM)

    In your code, you have not provided Original Location ID.

    So first you will have to add a new record to the Data Location Table and then use AddRecord to add the Binary Object.

    For adding a record to the Data Location Table you can use <b>AddDataLocation method of the Catalogdata class.

    </b>

    Hope this will solve your problem.

    Let me know the result.

    Regards,

    <b>Rashmi Jadhav</b>

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Rashmi,

      thanks a lot !!!

      I add this line

      <b>

      int origLocationId = repData.AddDataLocation("c:
      ", 0, DataLocationType.RemovableMediaLocation);

      flds.Add(new A2iField("Original_Location_ID", new Value(origLocationId)));</b>

      and now I not have problems!!!

      Best regards

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2007 at 02:06 PM

    Hello,

    I have used this thread to add images via the java api and it works great, however from the data manager and image manager I am unable to generate thumbnails of images that have been added via the API. There is no error message. Any help on this? Should images be added another way via the API?

    Thanks

    Kevin

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.