Hitachi Vantara Pentaho Community Wiki
Child pages
  • Managing Data Sources in the Pentaho BI Platform
Skip to end of metadata
Go to start of metadata

When using enterprise Java applications, it is not considered good to instantiate database connections manually. The more standard method involves using a database connection pool in the form of a JDBC data source, which is provided by your application server (Tomcat, Jetty, WebLogic). The application server is responsible for maintaining a number of connections to the database service, and the code locates the data source through JNDI to obtain a connection.

In some instances, however, you want to be able to manage and maintain the efficiency and centralization of the database connection pool. Consider the following scenarios:

  • Your application runs in a managed environment and you don't have access to the application server's administrative console. This is common in the corporate environment, as well as with some Web hosts.
     
  • You want a container-neutral Web application that can be deployed by third parties with minimal intervention on your part.
     
  • Your application runs in a special environment, such as a demo CD-ROM, that requires it to be even more self-contained than a standard Web application.
     

Configuring Platform to Use Pentaho-Managed Data Sources

The Pentaho BI Platform uses Pooled + JNDI data sources by default.

  • PooledDatasourceService 
  • NonPooledDatasourceService.
  • PooledOrJndiDatasourceService 
  • NonPooledOrJndiDatasourceService.

If you decide to not use the Pentaho-managed data sources (the data sources that are created through the Pentaho Admin Console) you can use either NonPooledDatasource Service or NonPooledOrJndiDatasourceService.

PooledDatasourceService:

This datasource service retrieve the datasource objects from a connection pool already setup during the server startup. If it encounters a new datasource being requested, it will read the meta data and add the datasource to the connection pool. You will not be able to use any JNDI connection with this service

NonPooledDatasourceService:

This datasource service retrieves the datasource meta data from the database and construct the datasource object for you. It stores these datasource info in the cache for it to be used for the next time. You will not be able to use any JNDI connection with this service

PooledOrJndiDatasourceService:

If you desire to use pooled and jndi connection togather, you will need to use this service. When the request is made for a datasource connection, it first finds in the pooled connection and if the datasource is not available it searches with the default JNDI provider for that datasource. If the datasource have the same name in pooled and jndi, the pooled one will take precidence.

NonPooledOrJndiDatasourceService:

If you desire to use non pooled and jndi connection togather, you will need to use this service. When the request is made for a datasource connection, it first finds in the cache for the datasource and if the datasource is not available it searches with the default JNDI provider for that datasource.If the datasource have the same name in pooled and jndi, the pooled one will take precidence.



 If applicable, change these configuration by modifying the pentahoObject.spring.xml in the pentaho-solutions/system folder.

<entry key="IDatasourceService">
      <bean class="org.pentaho.platform.engine.core.system.objfac.LocalObjectCreator">
        <!--<constructor-arg><value>org.pentaho.platform.engine.services.connection.datasource.dbcp.JndiDatasourceService</value></constructor-arg>-->
        <!--<constructor-arg><value>org.pentaho.platform.engine.services.connection.datasource.dbcp.NonPooledOrJndiDatasourceService</value></constructor-arg>-->
        <!-- <constructor-arg><value>org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledDatasourceService</value></constructor-arg>-->
        <!--<constructor-arg><value>org.pentaho.platform.engine.services.connection.datasource.dbcp.NonPooledDatasourceService</value></constructor-arg> -->
        <constructor-arg><value>org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledOrJndiDatasourceService</value></constructor-arg>
      </bean>
   </entry>

You must also include a version of DatasourceSystemListener. For connection pooling solution use the PooledDatasourceSystemListener. For the regular, non-pooling option use NonPooledDatasourceSystemListener. The listeners are plugged through the systemListeners.spring.xml in the pentaho-solutions/system folder.

<beans>
	<bean id="systemListenersList" class="java.util.ArrayList">
		<constructor-arg>
			<list>
				<bean class="org.pentaho.platform.plugin.action.jfreereport.JFreeReportSystemListener"/>
				<bean class="org.pentaho.platform.plugin.action.kettle.KettleSystemListener"/>
				<bean class="org.pentaho.platform.plugin.action.mondrian.MondrianSystemListener"/>
				<bean class="org.pentaho.platform.scheduler.QuartzSystemListener"/>
				<bean class="org.pentaho.platform.engine.services.metadata.PMDSystemListener"/>
				<bean class="org.pentaho.platform.scheduler.versionchecker.VersionCheckSystemListener">
					<property name="repeatIntervalSeconds">
						<value>86400</value>
					</property>
					<property name="requestedReleases" value="Minor, GA"/>
					<property name="disableVersionCheck">
						<value>false</value>
					</property>
				</bean>
 			<!-- <bean class="org.pentaho.platform.engine.services.connection.datasource.dbcp.NonPooledDatasourceSystemListener"/> -->
 			<!-- <bean class="org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledDatasourceSystemListener"/>-->
			</list>
		</constructor-arg>
	</bean>
</beans>

PooledDatasourceListener:

This listener reads the data source metadata from the database and setup connection pools and stores this information in a cache.

NonPooledDatasourceSystemListener:

This listener* listener loads the database metadata into the cache. If the cache manager is not available,it will use a simple map implementation of ICacheManager.

  • No labels