notes数据库api

用Java远程操作Domino服务器的例子
1.服务器必须启动DIIOP服务,Domino控制台命令:load diiop(启动DIIOP服务)
2.推荐用IOR的方式访问Domino服务器,其它方式可能需要服务器设置为匿名访问,用IOR匿名和不允许匿名都可以
3.通过String Ior=NotesFactory.getIOR("127.0.0.1","admin","password");首先取到Ior;服务器名根据你的实际情况填写,用户名和密码是登录internet的用户名和密码,如果是匿名可以不写
4. 创建Session对象 localSession = NotesFactory.createSessionWithIOR(Ior,"admin","password");然后就可以多数据库进行操作了
5.把Domino的安装路径放到path中,如果不放会报错提示找不到文件
Exception in thread "main" java.lang.UnsatisfiedLinkError: no nlsxbe in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at lotus.notes.NotesThread.load(Unknown Source)
at lotus.notes.NotesThread.(Unknown Source)
at lotus.test.AccessDomino.main(AccessDomino.java:16)

6.示例代码:
package lotus.test;
import lotus.domino.*;
public class AccessDomino {
/**
* @Description TODO 
* @param args
* @date 2008-11-25 15:08:50
* @author zys
* @return void 
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

lotus.notes.NotesThread.sinitThread(); 
lotus.domino.Session localSession = null;

try {
String Ior=NotesFactory.getIOR("127.0.0.1","admin","password");
localSession = NotesFactory.createSessionWithIOR(Ior,"admin","password");
String p = localSession.getPlatform();
System.out.println(localSession.getServerName());
System.out.println("Platform = " + p);
} catch (NotesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
lotus.domino.Database db = null;
try {
db = localSession.getDatabase("Server1/LotusDevelop","log.nsf");
System.out.println(db.getTitle());
//View view=db.getView("vwdjbymainid");
//System.out.println(view.getColumnCount());
//System.out.println(view.getEntryCount());
} catch (NotesException e) {
e.printStackTrace();
}

}
}

你可能感兴趣的:(Lotus,domino)