我们的项目使用 Websphere,我们必须使用WSConnection设置“客户端信息” 。DB2 数据库使用这些进行审计。这在 Websphere 中运行良好。但是,我们现在想在 websphere 外部运行的控制台应用程序中使用相同的代码库。所以我想将下面的代码更改为对 websphere 是否不可知。
是否有一些更标准的方法来完成以下?使用直接jdbc的东西?或者其他一些让我不创建从这个代码到 websphere 及其库的依赖项的方法?
Properties props = new Properties();
props.setProperty(WSConnection.CLIENT_ID, userid);
props.setProperty(WSConnection.CLIENT_APPLICATION_NAME, bpcode);
if (connection instanceof WSConnection) {
WSConnection wconn = (WSConnection) connection;
wconn.setClientInformation(props);
} else {
log.error("Connection was NOT an instance of WSConnection so client ID and app could not be set");
}
MMMHUHU
相关分类