Can anyone provide instructions on how to do this? I have several different JDBC DataSources set up and would like to be able to configure users to run the same report using different datasources. E.g. when user A logs in and runs report A, datasource 1 is used; when user B logs in and runs report A, datasource 2 is used. I am using version 4.0.
相关问题
- JasperReports Server parameter dependency
- Visual Studio 2015 : SQL Data Source : Unable to r
- Storing data in XML or SQL?
- Spring Boot JNDI resource-ref
- what is the physical path that Jasperserver store
相关文章
- Fuse 6.3 dbcp basic datasource
- Modularization of Jasper reports: Pass data source
- JBoss AS 5 database connection pool re-connect rou
- MyBatis-guice 3.3 + Multiple datasources + propert
- Cake php Datasource class MySQL could not be found
- Can I use multiple C3P0 datasources for DB instanc
- How To Pass a JRBeanCollectionDataSource to iRepor
- Is it possible to use a datasource deployment desc
It seems to be possible now, though maybe not per user but more per role. So you could set up a bunch of datasources, e.g. for roles admin, manager, user, guest and then use the appropriate datasource for the user.
Switching A DataSource Based On A User - JasperSoft Community Wiki
Something like this could be achieved by using a multi-tenant version of JasperReports Server. You would have 2 (or more) tenancies/companies, where users are assigned to a different company. When logging on the user will only see the reports/resources belonging to that company. That way you can have a different datasource per company, have the same reports setup in each company, but each report unit will point to the respective datasource. If you're worried about duplication of reports, but the common report JRXML resource files into a common folder that can be seen by both companies (eg at root level) and have the report units refer to these as sub-reports.
I'm working with release 6.2 of JasperReports Server and this is perfectly possible, as users have attributes and you can reference these attributes in the datasource connection settings.
For example you would not set an specific ip for your DB host. Instead you would reference a user attribute (attributes can be defined for the user or inherited from organizations or the server itself):
or
The former tries to find the attribute in the whole hierarchy (User > Organization > Parent Organization > Server). The latter expects to find the attribute defined at user level.
You can find a complete explanation in section 4.1 of JasperReports Server Admin Guide and here:
http://community.jaspersoft.com/documentation/tibco-jasperreports-server-administrator-guide/v601/attributes-data-source-definitions
There isn't a built-in functionality in JasperReports Server to do so. You would need to implement a Java Extension that would work as a wrapper for JDBC datasources. This wrapper would utilize either an existing connection selected per user or the user object itself to pass the required information to the datasource. This article might be for an earlier version but can guide you in the right direction.
More details on custom datasources in general you can also find in the samples/customDataSource folder in JasperReports Server installation (jasperserver-install-dir/samples)