JasperReports Server:根据用户切换JDBC数据源 [英] JasperReports Server: Switching JDBC datasources depending on user

查看:115
本文介绍了JasperReports Server:根据用户切换JDBC数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供有关如何执行此操作的说明吗?我设置了几个不同的JDBC数据源,并希望能够配置用户以使用不同的数据源运行同一报表。例如。当用户A登录并运行报告A时,将使用数据源1;当用户B登录并运行报告A时,将使用数据源2。我正在使用版本4.0。

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 6.2版本,这完全有可能,因为用户已经拥有属性,您可以在数据源连接设置中引用这些属性。

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.

例如,您不会为数据库主机设置特定的IP。相反,您可以引用用户属性(可以为用户定义属性,也可以从组织或服务器本身继承属性):

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):

host = {attribute('dbHost')}

host = {attribute('dbHost', 'User')}

前者尝试在整个层次结构中查找属性(用户>组织>父组织>服务器)。后者希望找到在用户级别定义的属性。

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.

您可以在 JasperReports服务器管理指南的第4.1节中找到完整的说明,并在此处:

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

这篇关于JasperReports Server:根据用户切换JDBC数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆