打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
java程序远程访问Domino数据库简例

package kenny.remote;
import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.NotesException;
import lotus.domino.NotesFactory;
import lotus.domino.Session;
import lotus.domino.View;
/**
 * @author Kenny
 * example:java程序远程访问Domino服务器
 */
public class ConnectDomino {
 //要访问的Domino服务器域名,也可以用IP,默认的DIIOP端口是63148,若不知道端口,请询问管理员
 private final static String HOST = "oa.abc.com.cn:63148";
 //用户名必须是name.nsf中注册的用户名,当然如果服务器允许匿名访问,这可以不需要此用户名
 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{
   //建立连接会话,若匿名访问,用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 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();
   }
  }
 }
}

     另外,java程序的类路径必须包含NCSO.jar,此包可以从安装了Domino服务器或者Domino Designer客户端软件的计算机上获得,具体路径为\Data\domino\java。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
[Domino]如何用java远程访问Domino邮箱数据
Java读取FTP上的txt文件
Domino連接池解決方案
Ext与后台数据库交互
POI 操作Excel
JAVA算法与编程题
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服