You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by SudheerKumar <su...@gmail.com> on 2009/02/27 13:02:19 UTC

How to bind and search binary data in Apache DS?

Hi, I am new to LDAP and Apache DS.  Kindly help me solve my problem. 

I have an attribute with binary (m-syntax: 1.3.6.1.4.1.1466.115.121.1.5) as
its type.  This attribute is  added as an attribute to an Object class.  I
tried to bind a String value (xml) to it.  Using the following line of code.  

       String xml = getXml();
      

       LdapContext.modifyAttributes(dn,
				new ModificationItem[] { new ModificationItem(
						DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
								"myAttributeName", xml)) })




It throws an exception saying: "ERROR Ldap server exception: [LDAP: error
code 80 - OTHER: failed for     Modify Request
        Object :
'cn=sudheer,ou=Preferences,ou=My_Org_Name,ou=Applications,dc=myorg,dc=com'
            Modification[0]
                Operation :  replace
                Modification
    myattributeName: '0x3C 0x3F 0x78 0x6D 0x6C 0x20 0x76 0x65 0x72 0x73 0x69
0x6F 0x6E 0x3D 0x22 0x31 ...'
            Modification[1]
                Operation :  replace
                Modification
    myattributeNametimestamp: 1233046896765: java.lang.String]
ERROR Failed to save home pages in LDAP."

Converting the String to byte array ( byte[] contentInBytes =
xml.getBytes()) doesn't solve the problem.  Then just for verification I
read a jpeg file using BufferedInputStream and extracted the content to a
byte array. This time it successfully stored the byte array data.  However,
when retrieving the data back, what I am getting is a Char array. Why it
doesn't return a byte array?  How do I store String values in binary format?
Please help.
-- 
View this message in context: http://www.nabble.com/How-to-bind-and-search-binary-data-in-Apache-DS--tp22244555p22244555.html
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Re: How to bind and search binary data in Apache DS?

Posted by SudheerKumar <su...@gmail.com>.
---Sorry for that.  I will move this question to the users mailing list.  By
the way Apache DS version that I use is 1.5.4.   If you have any
solutions/recommendations please do reply.

-- 
View this message in context: http://www.nabble.com/How-to-bind-and-search-binary-data-in-Apache-DS--tp22244555p22259180.html
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Re: How to bind and search binary data in Apache DS?

Posted by Emmanuel Lecharny <el...@apache.org>.
SudheerKumar wrote:
> Hi, I am new to LDAP and Apache DS.  Kindly help me solve my problem. 
>   
Two things :
- we have a users mailing list for such mails. please use it.
- which version of ADS are you using ?

-- 

--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org