我需要使用WebLogic应用程序服务器10.3.6上安装的ASI建立与Granite数据库的连接。 编程语言是Java:
public void connect() throws Exception {
if (prop != null) {
ConnectionFactoryASI.setProtocol(prop);
ConnectionFactoryASI.setDataObjectFactoryType(prop);
serviceFactory = ConnectionFactoryASI.getServiceFactory(prop);
} else {
serviceFactory = ConnectionFactoryASI.getServiceFactory(user);
}
dataObjectFactory = serviceFactory.getDataObjectFactory();
setUser(serviceFactory.getClientSession().getLoginName());
logger.debug("ASI HostName: " + serviceFactory.getClientSession().getHostName()
+ ", DatabaseName: " + serviceFactory.getClientSession().getDatabaseName()
+ ", DbHostName: " + serviceFactory.getClientSession().getDbHostName());
}
它没有连接并且给我一个连接错误。
答案 0 :(得分:0)
ASI需要一个连接ticketName,没有它就无法打开连接。
这是正确的代码,我添加了上面写的参数:
public void connect(String ticketName) throws Exception {
if (prop != null) {
ConnectionFactoryASI.setProtocol(prop);
ConnectionFactoryASI.setDataObjectFactoryType(prop);
serviceFactory = ConnectionFactoryASI.getServiceFactory(prop, ticketName);
} else {
serviceFactory = ConnectionFactoryASI.getServiceFactory(ticketName, user);
}
dataObjectFactory = serviceFactory.getDataObjectFactory();
setUser(serviceFactory.getClientSession().getLoginName());
logger.debug("ASI HostName: " + serviceFactory.getClientSession().getHostName()
+ ", DatabaseName: " + serviceFactory.getClientSession().getDatabaseName()
+ ", DbHostName: " + serviceFactory.getClientSession().getDbHostName());
}