Connect to Notes DB using JAVA

Is there a way a J2EE/JAVA Application can talk to a notes server
to import the company's addressbook (via JDBC or maybe an API.
I'm using JBOSS as an app server on a unix machine. Points
will be increased for really helpful answer.
LVL 5
apparitionAsked:
Who is Participating?
 
qwaleteeCommented:
OK.  There are two ways to run Java against Notes.  You either have Notes or DOmno installed locally, or you use CORBA/IIOP.  Since you are runing on Unix, and the Notes client is not available on Unix, then a local run would require a locally installed Domino server.  I assume that's unlikely, so we'll focus on CORBA/IIOP.

The srever has to run the IIOP task (actually called DIIOP), as well as the HTTP task.  You may need to modify some of the security settings for the server., and possibly network settings that Domino uses -- but you probably will not have to.

On the "client" (JBoss):

You will need to obtain NCSO.jar, which you can get from the Domino server install.  Put it in the CLASSPATH.  Import lotus.domino.* -- if your coding conventons preclude you from using wildcard, let me know, and we can discuss what you need to import; yuo can probably figure that out yourself, though.

Session is instantiated as follows:
Session session = NotesFactory.createSession(Domino_host, userName, password);

All three parameters are strings.
Domino_host is the Domino network address, whether hostname or IP.
UserName is a canonical name listed in the Domino directory, e.g., Apparition/Systems/IT/AcmeCorp
Password is the HTTP password asigned to UserName.  If you have any questions about this, you need to talk to the Domino administrator, because sometimes companies protect access to password setup, or require you to go through a custom process.  Normally, Domino allows you to edit the Internet Password field on your directory Person document.
0
 
qwaleteeCommented:
Yes.  There is a JDBC driver for NOtes.  I am not certain, but I believe it requires that Notes client or DOmino server is installed on teh machine where the driver is used.  You would select from the "table" named Person in the database names.nsf. (Names.nsf is teh DOmino directory.  Some companies use a separate database for the company directory, instead ofthe Domino built-in directory, which is similar to, and compatible with, LDAP directories).

f you are using names.nsf, tell me which fields you need to pull, and I will tell you which columns match. If you are using something besides names.nsf, I would have to know the structure.

You can also access the data via the DOmino object model, which is exposed to Java.  You would use Session.getDatabase (the core object) to return a Database, Database.getView to retrun a view (index) of all data you need, and, if you want to keep teh code siple, use View.getFirstDOcument / View.getNextDocument to return individual records.  Within the record, there are many methods to retrieve fields as vectors of (usually string) values, or to return teh fields themselves as Item objects.
0
 
apparitionAuthor Commented:
JDBC will only work on a windows machine. I think the Java Toolkit available on the notes website should be used for
what I want to do. Has anyone used the java toolkit?
heres the link

http://www-10.lotus.com/ldd/notesua.nsf/a08df36b2299a8bc8525665d006dce40/c3bf8b8e9920c7d4852569810055a661?OpenDocument 
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
qwaleteeCommented:
The toolkit is the same as the Domino Object Model.

The object odel is almost the same across multiple acces points... internal LotusScript, internal Java, OLE automaion, external Java code running on a Domino/Notes box, external Java code running over CORBA.

I've done a few systems using the CORBA bridge.  Mostly, though,  use local installs, and Java access is a niche in the first place.

Let me know if you have any specific questions, and I'll try to answer them.  I really can't give you a broad overview, it would not make sense in this forum.  What data do you specifically expect to read from/write to in Domino?
0
 
apparitionAuthor Commented:
This is what I need to do exactly,

I have a JSP/JAVA web application sitting on a unix box as I mentioned before I need to create a page in the
application that will display my company's adress book from a notes DB(names.nsf) sitting on a different server.
0
 
apparitionAuthor Commented:
I have downloaded the toolkit and trying to get it work on my local machine that has designor installed.
0
 
qwaleteeCommented:
You might want to use LDAP instead, as you can use some run of the mill classlibs to access the Domino directory data that way.

Which particular page of the directory are you trying to display?  I can proably give you some sample code.
0
 
apparitionAuthor Commented:
all I need to do is display a list of all the names
0
 
qwaleteeCommented:
Then LDAP will do quite nicely.

However, if you insist...

            try {
                  Session session = getSession();
                  AgentContext agentContext = session.getAgentContext();
                  
                  Database nab = session.getDatabase( "" , "names.nsf" );
                  View peopleView = nab.getView("People");
                  ViewNavigator peopleNav = peopleView.createViewNav();
                  ViewEntry row = peopleNav.getFirst();
                  while(row!=null) {
                        Vector v = row.getColumnValues();
                        for (int i=0; i<v.size(); i++) {
                              if (v.elementAt(i) != null) {
                                    System.out.println("Column " + (i+1) + ":\t" + v.elementAt(i));
                              }
                        }
                        System.out.println();
                        row = peopleNav.getNext(row);
                  }



            } catch(Exception e) {
                  e.printStackTrace();
            }
0
 
apparitionAuthor Commented:
This is not the part of the code I am having a problem with I dont know how to connect
to my notes server since its on a different box from where my web application is
0
 
apparitionAuthor Commented:
Perfect this answers my question. I downloaded the NCSO.jar but wasn't sure if I could connect remotely to notes remotely. I have already talked to my notes admin and he's setting up the notes server settings. Thankyou but I only have 45 points right now I will give you more points when I get them
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.