我正在尝试使用部署 API 为数据源启用验证池连接复选框。
AttributeList preTestConnections = new AttributeList();
preTestConnections.add(new Attribute("name", "preTestConnections"));
preTestConnections.add(new Attribute("type", "java.lang.Boolean"));
preTestConnections.add(new Attribute("value", String.valueOf(dsc.isvalidationOnMatchEnbled())));
configService.addElement(session, resourcePropertySet, "resourceProperties", preTestConnections, -1);`
当我执行此操作时,预测试连接将添加到自定义属性,而不是数据源的WebSphere Application Server 数据源属性。
请提供 preTestConnections 的属性。
最佳答案
您可以在管理控制台的以下面板中完成此操作:
资源 > 数据源 > YOUR_DATASOURCE > WebSphere Application Server 数据源属性
这里的关键是该属性名为 testConnection
而不是 preTestConnections
您还可以使用 wsadmin 脚本来完成此操作:
AdminConfig.modify(
'(cells/myCell/nodes/myNode/server/server1|resources.xml#ConnectionPool_1)',
'[[testConnectionInterval "0"] [testConnection "true"]]')
您还可以使用 ConfigService API 来完成此操作:
AttributeList preTestConnections = new AttributeList();
preTestConnections.add(new Attribute("name", "testConnection"));
preTestConnections.add(new Attribute("type", "java.lang.Boolean"));
preTestConnections.add(new Attribute("value", String.valueOf(dsc.isvalidationOnMatchEnbled())));
configService.addElement(session, resourcePropertySet, "resourceProperties", preTestConnections, -1);
关于websphere-8 - 如何从 Websphere 应用程序服务器的部署 api 启用 preTestConnection 复选框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34310900/