Customization of Database Connection Service in the BI Server

You can override the default behavior of Pentaho's Database Connection Pool by implementing your own IDatasourceService class and overriding the pentaho-solutions/system/pentahoObjects.spring.xml file with your new implementation.  Multiple implementations of this class are available in open source with in the project "bi-platform-engine-services".

A useful utility class for defining per-user connections is PentahoSessionHolder, this class allows easy access to the IPentahoSession object that contains current user information.

Links to Javadoc:
http://javadoc.pentaho.com/bi-platform/3.6/org/pentaho/platform/api/data/IDatasourceService.html
http://javadoc.pentaho.com/bi-platform/3.6/org/pentaho/platform/engine/core/system/PentahoSessionHolder.html
http://javadoc.pentaho.com/bi-platform/3.6/org/pentaho/platform/engine/services/connection/datasource/dbcp/PooledOrJndiDatasourceService.html