这是我的第一篇文章,所以如果我犯了一些错误,我很抱歉。我正在使用 Utgard opc Da Java 库连接到 opc da 服务器。我注意到的是,为了连接到服务器,需要用户名和密码。相反,使用 c#,只需要 url。由于在工作中我们只使用 Java,有没有可能避免插入用户名和密码?那是因为该应用程序将安装到我们不知道任何用户凭据的多台 PC 中。对不起我的英语不好,任何帮助将不胜感激。提前感谢大家
所以,我认为这是可以在短时间内解决的问题。但是,这就是我想要做的:
private final static String host = "localhost";
private final static String domain = "localhost";
private final static String user = "ramserver1";
private final static String password = "ramserver1";
private final static String clsid = "FAFA7034-4C37-401E-BA8E-7162DB0AC278";
private final static String progId = "ThermoElectron.RESULTOPCServerDA.2";
private ConnectionInformation connectionInformation;
private Server server;
public String readValue;
public Group group;
public OpcConnection() throws JIException, UnknownHostException,
NotConnectedException, DuplicateGroupException {
this.connectionInformation = new ConnectionInformation();
this.connectionInformation.setClsid(clsid);
this.connectionInformation.setDomain(domain);
this.connectionInformation.setHost(host);
this.connectionInformation.setUser(user);
this.connectionInformation.setPassword(password);
server = new Server(this.connectionInformation,
Executors.newSingleThreadScheduledExecutor());
}
基本上,我创建了一个类 OpcConnection:在构造函数中,我初始化了连接所需的参数。我想删除设置用户和密码的行。关于安全性,我将身份验证级别设置为无,如下所示: 身份验证级别
我错过了什么?