Solved

Connect to Notes DB using JAVA

Posted on 2003-11-24
11
466 Views
Last Modified: 2013-12-18
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.
0
Comment
Question by:apparition
  • 6
  • 5
11 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 9815176
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
 
LVL 5

Author Comment

by:apparition
ID: 9818891
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
 
LVL 31

Expert Comment

by:qwaletee
ID: 9819092
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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 5

Author Comment

by:apparition
ID: 9819702
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
 
LVL 5

Author Comment

by:apparition
ID: 9819715
I have downloaded the toolkit and trying to get it work on my local machine that has designor installed.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9827673
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
 
LVL 5

Author Comment

by:apparition
ID: 9827698
all I need to do is display a list of all the names
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9829184
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
 
LVL 5

Author Comment

by:apparition
ID: 9831592
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
 
LVL 31

Accepted Solution

by:
qwaletee earned 45 total points
ID: 9833411
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
 
LVL 5

Author Comment

by:apparition
ID: 9833434
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

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Domino Application - View Refresh on Subform 15 96
@ command if structure getting unmanageable 12 100
Lotus Notes: Email Delivery Failure 5 173
LotusScript: Merge Data to Word File 22 92
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question