Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

tenant aware datasource and XMLA

$
0
0
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.

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>