Jump to content
We've recently updated our Privacy Statement, available here ×

ntatlock

Members
  • Posts

    7
  • Joined

  • Last visited

ntatlock's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare

Recent Badges

0

Reputation

  1. I know this is an old question, but since it is the first result on google.. Here is how I got it working using a MS SQL connection for a subreport (and using an Oracle db in main report), which removes the need to hardcode the connection to the sub report's data source on Jaspeserver: 1. pass the main data source to the report unit as usual, and create the other data source on jasper server you want to use in the sub report 2. in the main report, create a parameter $P{yourDataSourceParam} with Class type: com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource and default value expression: com.jaspersoft.jasperserver.api.engine.jasperreports.util.RepositoryUtil.getThreadRepositoryContext().getRepository().getResource(null,"/Data_Sources/YourDataSource") 3. Now you can call functions on this parameter and pass in the connection to your subreport...like this 4. On your main report, select the subreport and remove all the expression entries. Create a parameter that you will pass to the subreport named 'REPORT_CONNECTION', with expression like this: java.sql.DriverManager.getConnection($P{yourDataSourceParam}.getConnectionUrl(),$P{yourDataSourceParam}.getUsername(),$P{yourDataSourceParam}.getPassword()) 5. :)
  2. Here is how I got it working using a MS SQL connection for a subreport, which removes the need to hardcode the connection: 1. create the data source on jasper server you want to use in the sub report 2. in the main report, create a parameter $P{yourDataSourceParam} with Class type: com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource and default value expression: com.jaspersoft.jasperserver.api.engine.jasperreports.util.RepositoryUtil.getThreadRepositoryContext().getRepository().getResource(null,"/Data_Sources/YourDataSource") 3. Now you can call functions on this parameter and pass in the connection to your subreport...like this 4. On your main report, select the subreport and remove all the expression entries. Create a parameter that you will pass to the subreport named 'REPORT_CONNECTION', with expression like this: java.sql.DriverManager.getConnection($P{yourDataSourceParam}.getConnectionUrl(),$P{yourDataSourceParam}.getUsername(),$P{yourDataSourceParam}.getPassword()) 5. :)
  3. I was using oracle for main report, and trying to use ms sql server for subreport. The solution for me was to not use Java 8 and add sqljdbc41.jar to class path. Using the sqljdbc41.jar drivers worked when I changed the report to compile with Java 7. A few key things that took me some time to get right: From main report, the subreport settings have param map expression, connection expression and data source expression all blank. From the main report I pass a parameter to subreport's REPORT_CONNECTION. The param I created uses expression that looks like this: java.sql.DriverManager.getConnection("jdbc:sqlserver://host:port;databaseName=dbname","user","pw") The subreport is in a group header band. The query for the sub report is in the sub report only. Since i'm not running a query on main report, I need to select All Sections No Detail Good luck!
  4. Changed Severity from Major to Critical Changed Resolution from Unable to Reproduce to Reopened Changed Status from Closed to Feedback Requested I can duplicate it - Windows 7 x64, tried using both java 8.0_31 and java 7.0_75 (and setting compatibility to 6,7,8), eclipse Luna 4.4.1, Jaspersoft Studio 6.0.3.final. There is no way to install a data adapter.
  5. If you are using a custom font, make sure it is installed to the jasper server. I had a similar problem where all except pdf reports were generating, and this was the cause.
×
×
  • Create New...