virenptl40 Posted December 17, 2014 Share Posted December 17, 2014 I am not able to use diffrent datasouce for two same formatted report. It means it referes only last accessed report's datasource. I am not finding a way since last month. I am about to done with the development. Please help me. Thanks in advance. Link to comment Share on other sites More sharing options...
Java_Jasper Posted December 18, 2014 Share Posted December 18, 2014 Yes it is possible, but not recommended; everything but the main report connection must be defined within a parameter, and unless JNDI name spaces are configured for the various data sources, usernames and passwords must be stored within the JRXML itself; which for various reasons is not good design practice. Jasper is intended to use one datasource per report This info was obtained via "gertbeedfrobe" Enjoy! Link to comment Share on other sites More sharing options...
virenptl40 Posted December 19, 2014 Author Share Posted December 19, 2014 Thanks a lot for the reply. Exactly I am using one report per datasource. I have provided two different datasources for the two different report. But while executing this two reports in the same window, it is only referring one datasource for both the reports. And If I execute only single report then it works fine. Same I have tried with JNDI. I am not finding a way how to resolve this. May be this is a limitation for jasperserver. Link to comment Share on other sites More sharing options...
Java_Jasper Posted December 31, 2014 Share Posted December 31, 2014 Hmm, so what you are saying is you have 2 reports each with a separate data source. And when you execute both in same window only one data source is available, however separate they behave as expected. It sounds like you are taking about virtual data sources, which is in the commercial 5.0 version only. It allows multiple JDBC and/or JNDI data sources and use the combination as a single data source. Hope this helps. Link to comment Share on other sites More sharing options...
calculate.machine Posted January 16, 2015 Share Posted January 16, 2015 Jasper can only use one datasource. It provides no convenient way of using dynamic datasources. Generally you can use the user-defined datasource, but the code for doing this is not easy to write. Yet, this can be made easier if you use esProc to assist Jasper. The esProc script is as follows: result ${sCode}.query("select * from sales where OrderDate>=? and OrderDate <=?",begin,end) In a report, connect to Oracle database by assigning myDB1 to parameter sCode or MYSQL database by assigning myDB2 to the parameter. For more complicated cases, you can write code for connecting to different datasources. For details, please refer to http://esproc.blogspot.com/2015/01/esproc-assists-report-development.html . Link to comment Share on other sites More sharing options...
calculate.machine Posted January 16, 2015 Share Posted January 16, 2015 Jasper can only use one datasource. It provides no convenient way of using dynamic datasources. Generally you can use the user-defined datasource, but the code for doing this is not easy to write. Yet, this can be made easier if you use esProc to assist Jasper. The esProc script is as follows: result ${sCode}.query("select * from sales where OrderDate>=? and OrderDate <=?",begin,end) In a report, connect to Oracle database by assigning myDB1 to parameter sCode or MYSQL database by assigning myDB2 to the parameter. For more complicated cases, you can write code for connecting to different datasources. For details, please refer to http://esproc.blogspot.com/2015/01/esproc-assists-report-development.html . Link to comment Share on other sites More sharing options...
nthapa Posted January 28, 2015 Share Posted January 28, 2015 Yes, it is possible using vitual data sources:https://community.jaspersoft.com/documentation/jasperreports-server-administration-guide/v561/virtual-data-sourcesThis is some more work currently being done to allow more advanced feature like combining data source from different adapters. [uPDATED]After reading your post one more time seems like you want to use dynamic data sources. In one case you might want to use datasource1 and in another case you want to use datasource2. If this is want you want, then you can make use of profile attributes, it allows you to define server-level, tenant-level and user-level attributes. For example user-level attributes each user could have different value for a attribute defined. Hence using that attribute you can create different data source.https://community.jaspersoft.com/documentation/jasperreports-server-user-guide/profile-attributesHTH Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now