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

Re: JDBC-LDAP bridge: [LDAP: error code 32 - No such object]



When Error Code 32 (Object Not Found) occurs it is generally because the
base and/or the "from" clause is wrong.  I find it very helpful to use a
tool like vienna sql or a like jdbc based tool to tune my queries.  One
thing I do notice is that no search scope is specified, which could be
causing a problem.  The scope should be specified in wither the
connection string or in the SQL statement.  Documentation on how to do
this is on our site :

http://www.octetstring.com/Support/jdbcldapdriver/GettingStarted.html

Hope that helps

On Fri, 2003-09-05 at 07:22, Amal burman wrote:
> Hello,
> 
> I am using JDBC-LDAP bridge to connect a java program
> with an OpenLDAP server but failed with an error code
> 32. Can you help me to correct my code?
> 
> Reagrds,
> 
> 
> 
> Code of Java Program
> --------------------
> import
> com.octetstring.jdbcLdap.sql.statements.JdbcLdapSelect;
> import com.octetstring.jdbcLdap.jndi.*;
> import com.octetstring.jdbcLdap.sql.*;
> import com.octetstring.jdbcLdap.sql.statements.*;
> import javax.naming.directory.*;
> 
> import java.awt.*;
> import java.awt.event.*;
> import java.sql.*;
> import java.applet.Applet;
> 
> 
> public class database extends Applet implements
> ActionListener{
>  TextField driver = new TextField(60);
>  TextField url = new TextField(60);
>  TextField sql = new TextField(60);
>  Button doIt = new Button("Do it!");
>  TextArea resultArea = new TextArea(10,60);
>  
>  public void init() {
>   setLayout(new GridLayout(2,1));
>   Panel topPanel = new Panel();
>   topPanel.setLayout(new GridLayout(4,1));
>   Panel panels[]=new Panel[4];
>   for(int i=0;i<panels.length;++i){
>    panels[i]=new Panel();
>    panels[i].setLayout(new
> FlowLayout(FlowLayout.LEFT));
>   }
>   panels[0].add(new Label("Driver:"));
>   panels[0].add(driver);
>   panels[1].add(new Label("URL: "));
>   panels[1].add(url);
>   panels[2].add(new Label("SQL: "));
>   panels[2].add(sql);
>   doIt.addActionListener(this);
>   panels[3].add(doIt);
>   for(int i=0;i<panels.length;++i)
>    topPanel.add(panels[i]);
>   add(topPanel);
>   add(resultArea);
>   //driver.setText("sun.jdbc.odbc.JdbcOdbcDriver");
>   //url.setText("jdbc:odbc:gis;uid=\"\";pwd=\"\"");
>   //sql.setText("Select * from objectInfo");
> 
>  
> driver.setText("com.octetstring.jdbcLdap.sql.JdbcLdapDriver");
>  
> url.setText("jdbc:ldap://intranet.webhouse.com/dc=webhouse,dc=com";);
>   sql.setText("SELECT * FROM o=cc WHERE cn=Rakhi");
>  }
> 
>  void accessDB() {
>   try{
>    Class.forName(driver.getText());
>    Connection
> connection=DriverManager.getConnection(url.getText());
>    Statement statement = connection.createStatement();
>    boolean hasResults =
> statement.execute(sql.getText());
>    if(hasResults){
>     ResultSet result = statement.getResultSet();
>     if(result!=null) displayResults(result);
>    }else resultArea.setText("");
>    connection.close();
>   }catch(Exception ex){
>    resultArea.setText(ex.toString());
>   }
>  }
>  void displayResults(ResultSet r) throws SQLException
> {
>   ResultSetMetaData rmeta = r.getMetaData();
>   int numColumns=rmeta.getColumnCount();
>   String text="";
>   for(int i=1;i<=numColumns;++i) {
>    if(i<numColumns)
>     text+=rmeta.getColumnName(i)+" | ";
>    else
>     text+=rmeta.getColumnName(i);
>   }
>   text+="\n";
>   while(r.next()){
>    for(int i=1;i<=numColumns;++i) {
>     if(i<numColumns)
>      text+=r.getString(i)+" | ";
>     else
>      text+=r.getString(i).trim();
>    }
>    text+="\n";
>   }
>   resultArea.setText(text);
>  }
>  public void actionPerformed(ActionEvent ev){
> 	if(ev.getSource()==doIt) {
>    	 	accessDB();
> 		System.out.println(driver.getText());
> 		System.out.println(url.getText());
> 		System.out.println(sql.getText());
>   	}
>  }
> }
> 
> 
> Directory Entries
> -----------------
> GQ Dump
> -----------------------------------
> # This file was generated by gq 0.4.0
> (http://biot.com/gq/)
> # run by ab Mon Sep 1 21:25:32 2003
> # subtree search on dc=webhouse,dc=com
> # server: localhost:389
> # binddn: cn=Manager, dc=webhouse, dc=com
> version: 1
> dn: dc=webhouse, dc=com
> dc: webhouse
> objectClass: dcObject
> 
> dn: o=cc, dc=webhouse,dc=com
> o: cc
> objectClass: organization
> 
> dn: cn=Rakhi,o=cc,dc=webhouse, dc=com
> cn: Rakhi
> sn: Barman
> mail: rakhi@yahoo.com
> objectClass: inetOrgPerson
> 
> =====
> 
> Amal Burman, Flat No. 302, E/99, Baghajatin, Calcutta 700086 Ph:98302-89790 
> 
> E-mail:amalburman@yahoo.com
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
-- 
Marc Boorshtein <marc.boorshtein@octetstring.com>
OctetString