cancel
Showing results for 
Search instead for 
Did you mean: 

JAVA API: Problem for insert Binary Object

former_member207329
Participant
0 Kudos

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 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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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>

former_member207329
Participant
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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