Solved

Connect to Notes DB using JAVA

Posted on 2003-11-24
11
460 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now