Pentaho JNDI source name as parameter (Multi-Tennant)

前端 未结 1 513
盖世英雄少女心
盖世英雄少女心 2021-01-29 02:12

I have googled this for the last half an hour, and found hits for pentaho parameters etc but nothing that appears to ask or answer this question.

I have a set of reports

相关标签:
1条回答
  • 2021-01-29 03:03

    OK, I have found a better solution using the little documented multi-tennant feature.

    1) Stop Pentaho

    2) Modify ( pentaho-solutions/system/pentahoObjects.spring.xml )

    <!-- Original Code
     <bean id="IDBDatasourceService" class="org.pentaho.platform.engine.services.connection.datasource.dbcp.DynamicallyPooledOrJndiDatasourceService" scope="singleton">
       <property name="pooledDatasourceService" ref="pooledOrJndiDatasourceService" />
       <property name="nonPooledDatasourceService" ref="nonPooledOrJndiDatasourceService" />
     </bean>
     -->
    
     <!--Begin Tenant -->
       <bean id="IDBDatasourceService" class="org.pentaho.platform.engine.services.connection.datasource.dbcp.tenantaware.TenantAwareLoginParsingDatasourceService"
       scope="singleton">
         <property name="requireTenantId" value="false" />
         <property name="datasourceNameFormat" value="{1}-{0}" />
         <property name="tenantSeparator" value="@" />
         <property name="tenantOnLeft" value="false" />
       </bean>
     <!-- End Tenant -->
    

    3) Add Suffix to Data Sources ( biserver-ce/tomcat/webapps/pentaho/META-INF/context.xml )

    <Resource
      name="jdbc/MYDBSRC-xxx"
      auth="Container"
      type="javax.sql.DataSource"
      factory="org.apache.commons.dbcp.BasicDataSourceFactory"
      maxActive="20"
      maxIdle="5"
      maxWait="10000"
      username="XXXX"
      password="XXXX"
      driverClassName="net.sourceforge.jtds.jdbc.Driver"
      url="jdbc:jtds:sqlserver://192.168.42.0:1433;DatabaseName=SOMEDB"
    />
    
    <Resource
      name="jdbc/MYDBSRC-aaa"
      auth="Container"
      type="javax.sql.DataSource"
      factory="org.apache.commons.dbcp.BasicDataSourceFactory"
      maxActive="20"
      maxIdle="5"
      maxWait="10000"
      username="XXXX"
      password="XXXX"
      driverClassName="net.sourceforge.jtds.jdbc.Driver"
      url="jdbc:jtds:sqlserver://192.168.42.0:1433;DatabaseName=AOTHERDB"
    />
    

    4) Delete /tomcat/conf/Catalina/localhost/pentaho.xml

    5) Restart Pentaho, create a user someone@xxx etc etc

    6) Create a report using the JNDI Name "MYDBSRC"

    7) Login as someone@xxx and you will get a different report / datasource than either logging in as user, or user@aaa

    Tadah !!

    0 讨论(0)
提交回复
热议问题