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

Re: jdbcldap connection



Your slapd.conf has the suffix of o=sbv,c=vn but you are connecting to just o=sbv. The entire root needs to be included, otherwise the bridge has no idea where to connect to.

------------------------------------------------------------------------ --------------------------
Marc Boorshtein
Sr. Software Engineer, Octet String
marc.boorshtein@octetstring.com
On Oct 5, 2004, at 7:44 PM, tuanva wrote:


Hi
I want to write module on Oracle, which will connect to Openldap database
and get. So I use jdbcldapdriver in my module. But when I test a example,
there are some error under. So can you help me to solve. Thank you very
much.


Here is my slapd.conf:
database ldbm
suffix "o=SBV,c=VN"
rootdn "cn=root,o=SBV,c=VN"
rootpw passwd
directory /Database
index objectClass,uid,uidNumber,gidNumber,memberUid eq
index cn,mail,surname,givenname eq,subinitial


My host for OpenLDAP server is 192.168.0.210
Here is conn using jdbcldapdriver:
    import com.octetstring.jdbcLdap.sql.statements.JdbcLdapSelect;
    import com.octetstring.jdbcLdap.jndi.*;
    import com.octetstring.jdbcLdap.sql.*;
    import com.octetstring.jdbcLdap.sql.statements.*;
    import java.sql.*;
    import javax.naming.directory.*;

    public class TestSQL {

 /** Creates a new instance of Test */
     public static void main(String[] args) throws Exception {
     System.out.println("Welcome to the JDBC LDAP Demo Application.");
      //JndiLdapConnection con;

    Class.forName("com.octetstring.jdbcLdap.sql.JdbcLdapDriver");

  // ldapConnString should be of the form...
  //  jdbc:ldap://host[:port]/base dn

     String ldapConnectString =
    "jdbc:ldap://192.168.0.210:389/o=sbv?SEARCH_SCOPE:=subTreeScope";;
    java.sql.Connection con;
    con = DriverManager.getConnection(
    ldapConnectString,
    "cn=root,o=SBV, c=VN",
    "passwd");
   System.out.println("Connection established");
   con.close();
  System.out.println("Test run finished.");
 }
}

Here is errors when I run example:
javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object];
remaining name 'o=sbv'


at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2889)

at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2810)

at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2616)

at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:931)

at
com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup(ComponentContext.jav a:522
)


at
com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialComposit eCont
ext.java:155)


at
com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialComposit eCont
ext.java:144)


at javax.naming.InitialContext.lookup(InitialContext.java:347)

at
com.octetstring.jdbcLdap.jndi.JndiLdapConnection.isClosed(JndiLdapConne ction
.java:270)


at
com.octetstring.jdbcLdap.jndi.JndiLdapConnection.<init>(JndiLdapConnect ion.j
ava:241)


at
com.octetstring.jdbcLdap.sql.JdbcLdapDriver.connect(JdbcLdapDriver.java :75)


at java.sql.DriverManager.getConnection(DriverManager.java:512)

at java.sql.DriverManager.getConnection(DriverManager.java:171)

at TestSQL1.main(TestSQL1.java:26)

Connection established

Test run finished.

Finished executing