Java 如何在DB2 JDBC连接属性创建之后更改它?

Java 如何在DB2 JDBC连接属性创建之后更改它?,java,jdbc,properties,Java,Jdbc,Properties,我在创建DB2连接之前设置该连接的ClientAccountingInformation属性,以便进行日志记录 this.properties.put("ClientAccountingInformation", "test"); lDbConection = DriverManager.getConnection(this.connectionString, this.properties); 但是每次使用这个连接时,我都需要设置一个不同的值,因为它来自一个连接池,并且被不同

我在创建DB2连接之前设置该连接的ClientAccountingInformation属性,以便进行日志记录

    this.properties.put("ClientAccountingInformation", "test");
    lDbConection = DriverManager.getConnection(this.connectionString, this.properties);
但是每次使用这个连接时,我都需要设置一个不同的值,因为它来自一个连接池,并且被不同的事务重用

事实上,我需要的是:

创建连接 使用值设置属性 使用连接 将其返回到连接池 为另一个事务再次获取它 将属性设置为值B 使用连接 将其返回到连接池 等等…

这是可能的:

    properties.put("ClientAccountingInformation", "test 2");
    lDbConnection.setClientInfo(properties);

你不能。在数据源中配置连接时,您必须设置特定属性,或者为每个事务手动设置属性。我需要为每个事务手动设置属性。但这只在创建连接之前的第一次起作用。在那之后,它没有任何效果。