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

Re: Regarding Octet String JDBC LDAP Bridge



I agreed with what Marc said ... One should be careful and clear 
about the context while making the connection and while executing 
the INSERT INTO statement.

You can send your sample code , so that I can look into it .

I will provide you with a sample code which i am test with Novell
eDirectory but it should work fine with iPlanet Directory also

I have created a Tree with the following structure

SAMPLE ( Tree Name  hosted on machine A.B.C.D
  |
  |--------- o = novell ( Container )
                | 
                | ------------ cn = admin ( User  with password no )



A Sample code can be 

public class Insert {
       public static void main(String[] args) throws Exception {

	Class.forName("com.octetstring.jdbcLdap.sql.JdbcLdapDriver");
	String ldapConnectString =
			"jdbc:ldap://A.B.C.D:38900/?SEARCH_SCOPE:=subTreeScope";;
	java.sql.Connection con;

	con =
DriverManager.getConnection(ldapConnectString,"cn=admin,o=novell","no");

	try {
		System.out.println("Attempting to insert test
records...");
		Statement stmt = con.createStatement();
		int count = 0;
		count =
		stmt.executeUpdate( INSERT INTO ou=clemens,o=novell
(objectClass,objectClass,ou) VALUES (top,organizationalunit,clemens)");
		if (count < 1) {
			System.out.println("Test Insert failed.");
		} else {
			System.out.println("Test Insert succeeded.");
		}
		stmt.close();
	} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("Test run finished.");
	}
}

Here these 2 statements in Bold are most important. While Establishing
the connection I have not specified any context and hence things are
working fine ..

Instead of the Above things if i do something like this , I will
encounter the same problem as faced by you...

String ldapConnectString
="jdbc:ldap://A.B.C.D:38900/o=novell?SEARCH_SCOPE:=subTreeScope";;
stmt.executeUpdate( INSERT INTO ou=clemens,o=novell
(objectClass,objectClass,ou) VALUES (top,organizationalunit,clemens)");

Because here it tries to insert the Organizational Unit ou=Clemens
under o=novell,o=novell which is a invalid context and u get the error

javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such
Object]; remaining name 'o=novell'

You can confirm this from Marc, though i am confident that this is the
correct behavior..

Hope this solves your problem

Thanks
Rahul Chatterjee


>>> Clemens Helf <helf@rus.uni-stuttgart.de> 09/24/03 02:09PM >>>
I am experiencing the same problem with the same stack trace.

 From the stack trace, I concluded, that no query has been issued yet,

so there can be no overlap between a query and the connection. To
verify 
my point, I removed the query from the source code and the same 
exception is thrown.

Despite the exception, the code continues to operate, so the exception

output is probably generated within a catch clause. I could
successfully 
execute a SELECT query despite the exception, but I was not able to 
execute an INSERT INTO query.

Clemens Helf

Marc Boorshtein wrote:
> This generally means that the base of the connection and the base of
the
> query overlap, for example when search o=People,c=us the connection
> could be at c=us and the search base should be ou=People.
> 
> Marc Boorshtein
> 
> On Tue, 2003-09-16 at 01:13, Prajakta Kalekar wrote:
> 
>>Hi,
>>	I am using Octet String's JDBC LDAP Driver for accessing
iPlanet
>>Directory Server data.
>>
>>After connection has been established, I get the following error:
>>
>>javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such
Object];
>>remaining name 'o=enlistautomatedtesting.com'
>>	at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
>>	at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
>>	at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
>>	at com.sun.jndi.ldap.LdapCtx.c_lookup(Unknown Source)
>>	at com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup(Unknown
>>Source)
>>	at
com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(Unknown
>>Source)
>>	at
com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(Unknown
>>Source)
>>	at javax.naming.InitialContext.lookup(Unknown Source)
>>	at
>>com.octetstring.jdbcLdap.jndi.JndiLdapConnection.isClosed(JndiLdapConnection
>>.java:270)
>>	at
>>com.octetstring.jdbcLdap.jndi.JndiLdapConnection.<init>(JndiLdapConnection.j
>>ava:241)
>>	at
>>com.octetstring.jdbcLdap.sql.JdbcLdapDriver.connect(JdbcLdapDriver.java:75)
>>	at java.sql.DriverManager.getConnection(Unknown Source)
>>	at java.sql.DriverManager.getConnection(Unknown Source)
>>	at octetString.Connect.main(Connect.java:38)
>>
>>	What can I do to overcome this problem? I require a solution to
this
>>problem urgently. Any pointers will be extremely valuable.
>>Thank you,
>>Prajakta Kalekar.