我尝试使用 jython 脚本启用验证数据源的现有池连接,但没有应用任何内容。但是,它适用于 validateNewConnection 属性。 我正在使用:
#Define validateNewConnection
name_validateNewConnection = ['name', 'validateNewConnection']
value_validateNewConnection = ['value', 'true']
validateNewConnectionAttrs = [name_validateNewConnection, value_validateNewConnection]
#Define validateExistingPooledConnection
name_validateExistingPooledConnection = ['name', 'validateExistingPooledConnection']
value_validateExistingPooledConnection = ['value', 'true']
validateExistingPooledConnectionAttrs = [name_validateExistingPooledConnection, value_validateExistingPooledConnection]
#Define validateExistingPooledConnectionRetryInterval
name_validateExistingPooledConnectionRetryInterval = ['name', 'validateExistingPooledConnectionRetryInterval']
value_validateExistingPooledConnectionRetryInterval = ['value', '3']
validateExistingPooledConnectionRetryIntervalAttrs = [name_validateExistingPooledConnectionRetryInterval, value_validateExistingPooledConnectionRetryInterval]
AdminConfig.create('J2EEResourceProperty', propSetvol, validateExistingPooledConnectionAttrs)
AdminConfig.create('J2EEResourceProperty', propSetvol, validateExistingPooledConnectionRetryIntervalAttrs)
AdminConfig.save()
validateExistingPooledConnection 和 validateExistingPooledConnectionRetryInterval 仅添加在自定义属性中。
尝试使用 testConnection 和 preTestConnections 属性名称,但没有成功。 我希望启用“验证现有池连接”并更改重试间隔。 有任何想法吗?预先感谢!
通过更改连接池中的 [testConnection "true"] [testConnectionInterval "3"]] 属性来实现。
ds = AdminConfig.getid(ServerScope + '/JDBCProvider:OracleJDBC/DataSource:DS_DB/')
conpool=AdminConfig.showAttribute(ds, 'connectionPool')
AdminConfig.modify(conpool, '[[testConnection "true"] [testConnectionInterval "3"]]')