[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
JDBC-LDAP Bridge. Pb when getting a binary attribute
Hi,
i got a problem when i try to get a
binary Object using th e JDBC-LDAP Bridge.
It seems that the object is always
cast as a String.
i try:
Class.forName("com.octetstring.jdbcLdap.sql.JdbcLdapDriver");
String ldapConnectString
="jdbc:ldap://ldapserver:389/dc=mydomain,dc=com?SEARCH_SCOPE:=subTreeScope";
java.sql.Connection con;
con
=DriverManager.getConnection(ldapConnectString,"","");
try {
Statement stmt =
con.createStatement();
ResultSet rs =
stmt.executeQuery("SELECT jpegPhoto FROM ou=People where
cn="theodore");
while (rs.next())
{
boolean bool =
rs.getObject("jpegPhoto") instanceof String;
if (bool)
System.out.println("jpegPhoto is a String");
else
System.out.println("jpegPhoto is not a String");
byte []
photo = (byte []) (rs.getObject("jpegPhoto"));
}
} catch (Exception e)
{
e.printStackTrace();
}
The result is
always:
jpegPhoto is a String
and then i got a
ClassCastException
Is a jpegPhoto (Type:
0.9.2342.19200300.100.1.60) really a byte[] or is it a problem whith the
bridge?
Thanks for your help,
Theodore