Java program remote access to domino database example

Source: Internet
Author: User

Package Kenny. Remote;
IMP ORT Lotus. Domino. database;
IMP ORT Lotus. Domino. Document;
IMP ORT Lotus. Domino. notesexception;
IMP ORT Lotus. Domino. notesfactory;
IMP ORT Lotus. Domino. Session;
IMP ORT Lotus. Domino. view;
/**
* @ Author Kenny
* Example: Java Program Remote access to the Domino server
*/
Public class connectdomino {
// The domain name of the Domino server to be accessed. You can also use an IP address. The default diiop port is 63148. If you do not know the port, ask the administrator.
Private Final Static string host = "oa.abc.com.com: 63148 ";
// The user name must be the user name registered in name. nsf. Of course, if the server permits anonymous access, this user name is not required.
Private Final Static string username = "admin ";
Private Final Static string Password = "admin ";
Public void getdominodb (){
Session session = NULL;
Database DB = NULL;
View view = NULL;
Document Doc = NULL, docx = NULL;
Try {
// Establish a connection session. If anonymous access is performed, use notesfactory. createsession (host ).
Session = notesfactory. createsession (host, username, password );
DB = session. getdatabase ("svrname", "dbname. nsf ");
View = dB. getview ("viewname ");
Doc = view. getfirstdocument ();
While (Doc! = NULL ){
// Process the document DOC
System. Out. println (Doc. getcreated ());
// Then get the next document
Docx = view. getnextdocument (DOC );
// Recycle the document we're re done with, in the loop body, that's necessary
If (Doc! = NULL) Doc. Recycle ();
Doc = docx;
If (docx! = NULL) docx. Recycle ();
}
} Catch (notesexception e ){
E. printstacktrace ();
} Finally {
Try {// all of the domino objects must be Recycle
If (docx! = NULL) docx. Recycle ();
If (Doc! = NULL) Doc. Recycle ();
If (view! = NULL) view. Recycle ();
If (DB! = NULL) dB. Recycle ();
If (session! = NULL) Session. Recycle ();
} Catch (notesexception erecycle ){
Erecycle. printstacktrace ();
}
}
}
}

In addition, the class path of the Java program must contain ncso. Jar. This package can be obtained from the computer where the Domino server or Domino designer client software is installed. The specific path is \ da.Ta \ domino \ Java.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.