US and Worldwide: +1 (866) 660-7555
Results 1 to 2 of 2

Thread: tenant aware datasource and XMLA

  1. #1

    Default tenant aware datasource and XMLA

    Hi,

    I have a tenant aware data source defined to associate user names with datasources. This works with CDF but it does not work with XMLA clients - like http://code.google.com/p/xmla4js/

    In pentahoObjects.spring.xml I define the IDatasourceService:

    Code:
    <bean id="IDatasourceService" 
    class="org.pentaho.platform.engine.services.connection.datasource.dbcp.tenantaware.TenantAwareLoginParsingDatasourceService"  scope="singleton">
        <property name="requireTenantId" value="false" /> 
        <property name="datasourceNameFormat" value="{0}-{1}" /> 
        <property name="tenantSeparator" value="-"/>
        <property name="tenantOnLeft" value="true" />
    </bean>
    In datasources.xml I define a catalog which uses the JNDI datasource "erpi":

    Code:
    <DataSources> 
      <DataSource> 
        <DataSourceName>Provider=Mondrian;DataSource=Pentaho</DataSourceName>
        <DataSourceDescription>Pentaho BI Platform Datasources</DataSourceDescription>
        <URL>http://localhost:8080/pentaho/Xmla?userid=joe&amp;password=password</URL>
        <DataSourceInfo>Provider=mondrian</DataSourceInfo> 
        <ProviderName>PentahoXMLA</ProviderName>
        <ProviderType>MDP</ProviderType>
        <AuthenticationMode>Unauthenticated</AuthenticationMode>
        <Catalogs> 
          <Catalog name="ERPI">
            <DataSourceInfo>Provider=mondrian;DataSource=erpi</DataSourceInfo>
            <Definition>solution:/admin/ERPI_SO_Schema.xml</Definition> 
          </Catalog> 
        </Catalogs>
      </DataSource> 
    </DataSources>
    The actual JNDI datasources with tenant names are defined in web.xml:

    Code:
    	<resource-ref>
    		<description>ERPBI Connection</description>
    		<res-ref-name>jdbc/joe-erpi</res-ref-name>
    		<res-type>javax.sql.DataSource</res-type>
    		<res-auth>Container</res-auth>
    	</resource-ref>
    	
    	<resource-ref>
    		<description>ERPBI Connection</description>
    		<res-ref-name>jdbc/tiffany-erpi</res-ref-name>
    		<res-type>javax.sql.DataSource</res-type>
    		<res-auth>Container</res-auth>
    and in context.xml:

    Code:
    <Resource
    	name="jdbc/joe-erpi" auth="Container" type="javax.sql.DataSource"
    	factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20"
    	maxIdle="5" maxWait="10000"
    	username="admin"
    	password="admin"
    	driverClassName="org.postgresql.Driver"
    	url="jdbc:postgresql://localhost:5432/joe-db"/>
    	
    <Resource
    	name="jdbc/tiffany-erpi" auth="Container" type="javax.sql.DataSource"
    	factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20"
    	maxIdle="5" maxWait="10000"
    	username="admin"
    	password="admin"
    	driverClassName="org.postgresql.Driver"
    	url="jdbc:postgresql://localhost:5432/tiffany-db"/>
    so user joe-erpi is associated with database joe-db and user tiffany-erpi is assocated with database fiffany-db.

    This works with CDF which I think, uses MDXConnection. But it does not work with XMLA. If I connect with:

    http://localhost:8080/pentaho/Xmla?u...sword=password

    I will see the joe-db database, but then if I connect with

    http://localhost:8080/pentaho/Xmla?u...sword=password

    I again see the joe-db database.

    If I clear the Mondrian cache and connect as tiffany-erpi I will see the tiffancy-db (but then joe-erpi gets wrong data)

    Any ideas are appreciated.
    Pentaho BI Solutions for ERP
    www.erpbisolutions.com

  2. #2

    Default

    Completed more research and it appears this is a Mondrian cache issue. When an IPentahoConnection is created for the datasource (the jndi) "erpi", the tenant aware routine TenantAwareLoginParsingDatasourceService is called getting the correct tenant id "tiffany". Then PooledOrJndiDatasourceService is called which finds the correct JNDI connnection "tiffany-erpi".

    So the JNDI connection associated with the IPentahoConnection connection is correct but apparently Mondrian identifies the IPentahoConnection as "erpi" when it looks in cache and so it can use the wrong cache.

    Any hints how to proceed?
    Pentaho BI Solutions for ERP
    www.erpbisolutions.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •