db2spring-jdbcapache-commons-dbcpdbcp

BasicDataSource not having property for clientProgramName


In my application we are creating connection pool as shown below

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close" driverClassName="com.ibm.db2.jcc.DB2Driver"
url="" username="" password="" clientProgramName="JavaClientApp"/>

As per this article, we are trying to set "clientProgramName", but is not working.

We also tried

connectionProperties="clientProgramName='JavaClientApp'"

Same configuration is working fine if i use com.ibm.db2.jcc.DB2SimpleDataSource instead of BasicDataSource but DB2SimpleDataSource does not have connection pool. We want to have connection pool and clientProgramName both.


Solution

  • I was able to resolve this issue by updating the url as showm below.

    jdbc:db2://<host>:<port>/<DB>:currentSchema=<schema>;clientProgramName=MyApp;