• 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。

  • 相关阅读:
    使用强名称为程序集签名
    使用SN.exe对.Net生成的程序集进行签名
    .Net 程序集 签名工具sn.exe 密钥对SNK文件 最基本的用法
    MongoDB查询
    mongo批量写入es
    用 Spark 处理复杂数据类型(Array、Map、JSON字符串等)
    kafka消费者
    kafka生产者
    Pyspark常用API总结
    selenium+chromedriver+python3 不加载图片
  • 原文地址:https://www.cnblogs.com/hannover/p/1839796.html
Copyright © 2020-2023  润新知