[Date Prev][Date Next] [Chronological] [Thread] [Top]

JDBC-LDAP Bridge V2 - Base64 encoding


I am using JDBC-LDAP Bridge v2 and i have a problem with base64 encoding.

In fact, i saw in the source code that sometimes, attributes are encoded,
sometimes not:

In com.octetstring.jdbcLdap.jndi.UnpackResults:

protected LDAPEntry extractEntry (...

byte[] bval = attrib.getByteValue();
   if (bval == null) {
    bval = new byte[0];
   if (Base64.isLDIFSafe(bval)) {
    svals = attrib.getStringValueArray();
   } else {
   byteVals = attrib.getByteValueArray();
    svals  = new String[byteVals.length];
    for (int i=0,m=byteVals.length;i<m;i++) {
     svals[i] = com.novell.ldap.util.Base64.encode(byteVals[i]);


It is OK for binary fields but the problem appears when i want to get value
of strings, i do not know if i have to decode it. Indeed, some strings are
not "ldifsafe" (like "Theodore") whereas others are (like "Villette").

I think the driver should decode values when there are encoded (in
com.octetstring.jdbcLdap.sql.LdapResultSet for example) before returning it.

Theodore Villette