kleinmannetje Posted November 15, 2010 Share Posted November 15, 2010 Hi,I am building a report with a subreport in it. I need the subreport to connect to another datasource then the main report. I got this working with a connection expression:java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname", "username", "password")The problem is we have different environments (development, testing, production) where the report has to be used and the database name and address is different for each environment. I want to use the datasource expression to solve this problem. This way we can add datasources on each envorinment and let the report point to this datasource instead of using a different connection expression on each environment.I tried the following exporessions, which didn't work:it.businesslogic.ireport.util.Misc.getConnection("repo:/datasource_name")it.businesslogic.ireport.util.Misc.getJRDataSource("datasource_name")net.sf.jasperreports.engine.JRDataSource("datasource_name")"repo:datasource_name"Does anyone know how to do this? Link to comment Share on other sites More sharing options...
kleinmannetje Posted November 18, 2010 Author Share Posted November 18, 2010 Nobody can help me with this problem? Is it even possible to do or do I need to search for another option? Link to comment Share on other sites More sharing options...
sekvoya Posted November 22, 2010 Share Posted November 22, 2010 Have U checked the Custom DataSources? That can be helpful in many situation, you just implement your own DataSource Class and instantiates it in the data source expression like:new net.sf.jasperreports.engine.JREmptyDataSource(1)In that way you can use any kind of parameters you want in the constructor.Hope this help./tools/fckeditor/editor/images/smiley/msn/regular_smile.gif Sek. Link to comment Share on other sites More sharing options...
Scott Andersen Posted June 14, 2022 Share Posted June 14, 2022 Here is a WIKI article that my provide a possible solution:https://community.jaspersoft.com/wiki/jaspersoft-report-using-two-separate-data-sources 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