You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Sudheer Kumar <su...@gmail.com> on 2009/03/02 11:18:50 UTC

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

>>As you are using JNDI you need to specify your attribute as binary.>>Either use the ;binary option or put your attribute to the>>"java.naming.ldap.attributes.binary" environment property. See [1] for>>more information.
>>Kind Regards,>>Stefan
>>[1] http://java.sun.com/products/jndi/tutorial/ldap/misc/attrs.html

------------------ Thanks for the information. However, what I want is to
store a String (an xml data) in the form of binary in Apache Directory
Server.  I used to store the same in Sun one and Tivoli and was successful.
 With Them I can simply bind String content to binary attributes and
retrieve them as String. I don't have to do anything at the client side.  I
need it because my xml content will be more than 64KB at times.   Is there
any setting in the server.xml for binary attributes? if so please give me a
sample or a link.    I used the "java.naming.ldap.attributes.binary" option
in JNDI and was able to get the byte array (an image I stored). What I want
is a similar setting where I would try to bind a String to an attribute
whose types is binary.

I tried storing a sample byte array as follows: 'byte[] newValue = new
byte[]{0x00, 0x01, 0x02, 0x03};' It was successful but, when I tried the
following:
byte[] newValue = new byte[]{0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20} it
FAILED!?? Why? What is the difference between the the first byte array and
second? So Apache DS read the content of the byte array and do some
filtering?

If I need to do any conversion at the client side what conversion do I need
to do? Please give an example. Or do I need to write a plug-in for this?

Thanks in Advance.
SudheerKumar

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

Posted by Emmanuel Lecharny <el...@apache.org>.
Sudheer Kumar wrote:
>>> As you are using JNDI you need to specify your attribute as binary.>>Either use the ;binary option or put your attribute to the>>"java.naming.ldap.attributes.binary" environment property. See [1] for>>more information.
>>> Kind Regards,>>Stefan
>>> [1] http://java.sun.com/products/jndi/tutorial/ldap/misc/attrs.html
>>>       
>
> ------------------ Thanks for the information. However, what I want is to
> store a String (an xml data) in the form of binary in Apache Directory
> Server.  I used to store the same in Sun one and Tivoli and was successful.
>  With Them I can simply bind String content to binary attributes and
> retrieve them as String. I don't have to do anything at the client side.  I
> need it because my xml content will be more than 64KB at times.   Is there
> any setting in the server.xml for binary attributes? if so please give me a
> sample or a link.    I used the "java.naming.ldap.attributes.binary" option
> in JNDI and was able to get the byte array (an image I stored). What I want
> is a similar setting where I would try to bind a String to an attribute
> whose types is binary.
>   
We had that in ApacheDS 1.0, but we removed it, as we have a better way 
to detect if the attribute is binary or not. All our attributes are now 
defined as either String or Binary internally. When you define a new 
AttributeType, you have to define it as binary if you want it to be 
binary (the defaukt is String, AFAIR).
> I tried storing a sample byte array as follows: 'byte[] newValue = new
> byte[]{0x00, 0x01, 0x02, 0x03};' It was successful but, when I tried the
> following:
> byte[] newValue = new byte[]{0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20} it
> FAILED!?? Why? 
I have no idea. Can you post the code you are using to demonstrate what 
you observe ?

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



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

Posted by Emmanuel Lecharny <el...@apache.org>.
Sudheer Kumar wrote:
> Thanks for the information. However, what I want is to
> store a String (an xml data) in the form of binary in Apache Directory
> Server.  
What for ? Is there any reason you want to transform your string to a 
byte[] ?

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